From b68169dd2bf0055718703038212ad7f413bf147c Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Mon, 1 Sep 2025 01:42:42 -0400 Subject: [PATCH] cool: I added figlet headings because I'm that cool --- Piece.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/Piece.cpp b/Piece.cpp index a9d81ad..0efc5d3 100644 --- a/Piece.cpp +++ b/Piece.cpp @@ -25,6 +25,28 @@ std::vector Piece::getLegalMoves(const Square &from, Board &board) const { std::vector moveList; return moveList; } + +bool Piece::finalMoveChecks(std::vector *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> kingVulnerable = { {-1, 0}, // Up @@ -159,6 +181,16 @@ std::vector King::getLegalMoves(const Square &from, Board &board) const { return moveList; } +// *INDENT-OFF* +// ## +// ## +// ## # ### ### ## ## +// #### ## ## ## ## ## # +// ## ## ## ## ## ### +// ## ## ## ## ## ## # +// ## ### ### ## ## +// *INDENT-OM* + std::vector Rook::getLegalMoves(const Square &from, Board &board) const { std::vector moveList; const int directions[4][2] = { @@ -189,6 +221,16 @@ std::vector Rook::getLegalMoves(const Square &from, Board &board) const { return moveList; } +// *INDENT-OFF* +// ### ## ## ### ### # ## +// ## # ## # ## # ## # ## ## +// ## # ## # #### #### ## ## +// ## # ## # ## ## ## ## +// ### ### ### ### ## ### +// ## +// ### +// *INDENT-ON* + std::vector Queen::getLegalMoves(const Square &from, Board &board) const { std::vector moveList; std::vector> directions = { @@ -226,6 +268,21 @@ std::vector Queen::getLegalMoves(const Square &from, Board &board) const { return moveList; } +// *INDENT-OFF* +// +// ## +// ## ## ## # +// ## ## ## +// ## ## # ## ## #### #### ### +// ## # ## ## ## ## # ## # ## +// ### ## ## ## ## # ## # ## +// ## # ## ## ## ### ## # ## +// ## ## ## ### ## ## ## ## ## +// #### +// # # +// #### +// *INDENT-ON* + std::vector Knight::getLegalMoves(const Square &from, Board &board) const { std::vector moveList; std::vector> directions = { @@ -241,6 +298,20 @@ std::vector Knight::getLegalMoves(const Square &from, Board &board) const return moveList; } +// *INDENT-OFF* +// +// ## +// ## ## ## +// ## ## +// ### ## ## #### ### ### +// ## # ## ## ## # ## ## ## # +// ## # ## ### ## # ## ## ## # +// ## # ## ## ## # ## ## ## # +// ### ## ### ## ## ### ### +// ## +// ### +// *INDENT-ON* + std::vector Bishop::getLegalMoves(const Square &from, Board &board) const { std::vector moveList; std::vector> directions = { @@ -252,6 +323,16 @@ std::vector Bishop::getLegalMoves(const Square &from, Board &board) const return moveList; } +// *INDENT-OFF* +// ### ## # # ## # ## +// ## # # ## # # # ## ## +// ## # ### # ### ## ## +// ## # # # #### ## ## +// ### ##### # # ## ### +// ## +// ### +// *INDENT-ON* + std::vector Pawn::getLegalMoves(const Square &from, Board &board) const { std::vector moveList; const int directions[2][4][2] = {