dev: Fixing compilation/linking errors, added other piece classes

This commit is contained in:
A.M. Rowsell 2025-08-04 21:45:23 -04:00
commit 2d83f43cfb
Signed by untrusted user who does not match committer: amr
GPG key ID: E0879EDBDB0CA7B1
4 changed files with 103 additions and 38 deletions

View file

@ -34,7 +34,7 @@ std::vector<Move> King::getLegalMoves(const Square &from, const Board &board) co
{0, -1}, // Left
{0, 1} // Right
};
return moveList;
}
std::vector<Move> Rook::getLegalMoves(const Square &from, const Board &board) const {
@ -50,14 +50,16 @@ std::vector<Move> Rook::getLegalMoves(const Square &from, const Board &board) co
int f = from.file + dir[1];
while (r >= 0 && r < 8 && f >= 0 && f < 8) {
const auto& target = board[r][f];
const auto& target = board.boardGrid[r][f];
auto ra = static_cast<Rank> (r);
auto fi = static_cast<File> (f);
Square targetSquare = {ra, fi};
if (!target) {
moves.push_back({from,
{r, f}});
} else if (target->color != this->color) {
moves.push_back({from,
{r, f}});
moveList.push_back({from,
targetSquare});
} else if (target->getColour() != this->colour) {
moveList.push_back({from,
targetSquare});
break;
} else {
break;
@ -70,3 +72,27 @@ std::vector<Move> Rook::getLegalMoves(const Square &from, const Board &board) co
return moveList;
}
std::vector<Move> Queen::getLegalMoves(const Square &from, const Board &board) const {
std::vector<Move> moveList;
return moveList;
}
std::vector<Move> Knight::getLegalMoves(const Square &from, const Board &board) const {
std::vector<Move> moveList;
return moveList;
}
std::vector<Move> Bishop::getLegalMoves(const Square &from, const Board &board) const {
std::vector<Move> moveList;
return moveList;
}
std::vector<Move> Pawn::getLegalMoves(const Square &from, const Board &board) const {
std::vector<Move> moveList;
return moveList;
}