cool: I added figlet headings because I'm that cool
This commit is contained in:
parent
6773da28fb
commit
b68169dd2b
1 changed files with 81 additions and 0 deletions
81
Piece.cpp
81
Piece.cpp
|
|
@ -25,6 +25,28 @@ std::vector<Move> Piece::getLegalMoves(const Square &from, Board &board) const {
|
|||
std::vector<Move> moveList;
|
||||
return moveList;
|
||||
}
|
||||
|
||||
bool Piece::finalMoveChecks(std::vector<Move> *moveList, Board &board) {
|
||||
// This function needs to do the final checks before declaring a move legal
|
||||
// Check to see if the piece that is being moves is currently blocking check
|
||||
// Check to see if a castle is trying to go through check or out of check
|
||||
// Check if it's a piece trying to capture the King (though this shouldn't happen normally)
|
||||
return true;
|
||||
}
|
||||
|
||||
// *INDENT-OFF*
|
||||
// ##
|
||||
// ## ##
|
||||
// ##
|
||||
// ## ## ## # ## ####
|
||||
// ## # ## ## ## ## #
|
||||
// ### ## ## ## ## #
|
||||
// ## # ## ## ## ###
|
||||
// ## ## ## ## ### ##
|
||||
// ####
|
||||
// # #
|
||||
// ####
|
||||
// *INDENT-ON*
|
||||
bool King::checkForCheck(Board &board) const {
|
||||
std::vector<std::vector<int>> kingVulnerable = {
|
||||
{-1, 0}, // Up
|
||||
|
|
@ -159,6 +181,16 @@ std::vector<Move> King::getLegalMoves(const Square &from, Board &board) const {
|
|||
return moveList;
|
||||
}
|
||||
|
||||
// *INDENT-OFF*
|
||||
// ##
|
||||
// ##
|
||||
// ## # ### ### ## ##
|
||||
// #### ## ## ## ## ## #
|
||||
// ## ## ## ## ## ###
|
||||
// ## ## ## ## ## ## #
|
||||
// ## ### ### ## ##
|
||||
// *INDENT-OM*
|
||||
|
||||
std::vector<Move> Rook::getLegalMoves(const Square &from, Board &board) const {
|
||||
std::vector<Move> moveList;
|
||||
const int directions[4][2] = {
|
||||
|
|
@ -189,6 +221,16 @@ std::vector<Move> Rook::getLegalMoves(const Square &from, Board &board) const {
|
|||
return moveList;
|
||||
}
|
||||
|
||||
// *INDENT-OFF*
|
||||
// ### ## ## ### ### # ##
|
||||
// ## # ## # ## # ## # ## ##
|
||||
// ## # ## # #### #### ## ##
|
||||
// ## # ## # ## ## ## ##
|
||||
// ### ### ### ### ## ###
|
||||
// ##
|
||||
// ###
|
||||
// *INDENT-ON*
|
||||
|
||||
std::vector<Move> Queen::getLegalMoves(const Square &from, Board &board) const {
|
||||
std::vector<Move> moveList;
|
||||
std::vector<std::vector<int>> directions = {
|
||||
|
|
@ -226,6 +268,21 @@ std::vector<Move> Queen::getLegalMoves(const Square &from, Board &board) const {
|
|||
return moveList;
|
||||
}
|
||||
|
||||
// *INDENT-OFF*
|
||||
//
|
||||
// ##
|
||||
// ## ## ## #
|
||||
// ## ## ##
|
||||
// ## ## # ## ## #### #### ###
|
||||
// ## # ## ## ## ## # ## # ##
|
||||
// ### ## ## ## ## # ## # ##
|
||||
// ## # ## ## ## ### ## # ##
|
||||
// ## ## ## ### ## ## ## ## ##
|
||||
// ####
|
||||
// # #
|
||||
// ####
|
||||
// *INDENT-ON*
|
||||
|
||||
std::vector<Move> Knight::getLegalMoves(const Square &from, Board &board) const {
|
||||
std::vector<Move> moveList;
|
||||
std::vector<std::vector<int>> directions = {
|
||||
|
|
@ -241,6 +298,20 @@ std::vector<Move> Knight::getLegalMoves(const Square &from, Board &board) const
|
|||
return moveList;
|
||||
}
|
||||
|
||||
// *INDENT-OFF*
|
||||
//
|
||||
// ##
|
||||
// ## ## ##
|
||||
// ## ##
|
||||
// ### ## ## #### ### ###
|
||||
// ## # ## ## ## # ## ## ## #
|
||||
// ## # ## ### ## # ## ## ## #
|
||||
// ## # ## ## ## # ## ## ## #
|
||||
// ### ## ### ## ## ### ###
|
||||
// ##
|
||||
// ###
|
||||
// *INDENT-ON*
|
||||
|
||||
std::vector<Move> Bishop::getLegalMoves(const Square &from, Board &board) const {
|
||||
std::vector<Move> moveList;
|
||||
std::vector<std::vector<int>> directions = {
|
||||
|
|
@ -252,6 +323,16 @@ std::vector<Move> Bishop::getLegalMoves(const Square &from, Board &board) const
|
|||
return moveList;
|
||||
}
|
||||
|
||||
// *INDENT-OFF*
|
||||
// ### ## # # ## # ##
|
||||
// ## # # ## # # # ## ##
|
||||
// ## # ### # ### ## ##
|
||||
// ## # # # #### ## ##
|
||||
// ### ##### # # ## ###
|
||||
// ##
|
||||
// ###
|
||||
// *INDENT-ON*
|
||||
|
||||
std::vector<Move> Pawn::getLegalMoves(const Square &from, Board &board) const {
|
||||
std::vector<Move> moveList;
|
||||
const int directions[2][4][2] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue