finished setbyfen

This commit is contained in:
rektdie committed 2025-03-12 14:30:12 +01:00
1 parent 69a7855f96
commit ad6ee77a46
2 files changed
+22 -3

No files matched your search

+12 -2
View File
@@ -58,8 +58,18 @@ void Board::SetByFen(std::string_view fen) {
sideToMove = tokens[1] == "b";
occupied = colors[White] | colors[Black];
hashKey = GetHashKey(*this);
for (const char piece : tokens[2]) {
if (piece == 'K') castlingRights |= whiteKingRight;
else if (piece == 'Q') castlingRights |= whiteQueenRight;
else if (piece == 'k') castlingRights |= blackKingRight;
else if (piece == 'q') castlingRights |= blackQueenRight;
}
if (tokens[3] != "-") enPassantTarget = parseSquare(tokens[3]);
occupied = colors[White] | colors[Black];
hashKey = GetHashKey(*this);
GenAttackMaps(*this);
}
void Board::PrintBoard() {