dev: started to write Board constructor, added all derived Pieces

This commit is contained in:
A.M. Rowsell 2025-08-04 02:54:55 -04:00
commit ea62d03680
Signed by untrusted user who does not match committer: amr
GPG key ID: E0879EDBDB0CA7B1
3 changed files with 85 additions and 18 deletions

View file

@ -1,7 +1,7 @@
/*
/*
* File: Piece.cpp
* Author: amr
*
*
* Created on July 30, 2025, 9:21 PM
*/
@ -24,12 +24,22 @@ std::vector<Move> Piece::getLegalMoves(const Square &from, const Board &board) c
std::vector<Move> King::getLegalMoves(const Square &from, const Board &board) const {
std::vector<Move> moveList;
const int directions[8][2] = {
{-1, 0}, // Up
{-1, -1}, // up-left
{-1, 1}, // up-right
{1, 0}, // Down
{1, -1}, // down-left
{1, 1}, // down-right
{0, -1}, // Left
{0, 1} // Right
};
}
std::vector<Move> Rook::getLegalMoves(const Square &from, const Board &board) const {
std::vector<Move> moveList;
const int directions[8][2] = {
const int directions[4][2] = {
{-1, 0}, // Up
{1, 0}, // Down
{0, -1}, // Left
@ -58,6 +68,5 @@ std::vector<Move> Rook::getLegalMoves(const Square &from, const Board &board) co
}
}
// calculate legal moves somehow
return moveList;
}