dev: Fixing compilation/linking errors, added other piece classes
This commit is contained in:
parent
ea62d03680
commit
2d83f43cfb
4 changed files with 103 additions and 38 deletions
42
Piece.cpp
42
Piece.cpp
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue