diff options
Diffstat (limited to 'src/board')
| -rw-r--r-- | src/board/board.cpp | 24 | ||||
| -rw-r--r-- | src/board/board.hpp | 19 |
2 files changed, 21 insertions, 22 deletions
diff --git a/src/board/board.cpp b/src/board/board.cpp index 22db36e..d0cf4c1 100644 --- a/src/board/board.cpp +++ b/src/board/board.cpp @@ -43,10 +43,10 @@ UndoMove MakeMove(Move move, Game *g) { undo.oldState = g->state; - undo.OldwhiteCastleKing = g->whiteCastleKing; - undo.OldwhiteCastleQueen = g->whiteCastleQueen; - undo.OldblackCastleKing = g->blackCastleKing; - undo.OldblackCastleQueen = g->blackCastleQueen; + undo.OldWhiteCastleKing = g->whiteCastleKing; + undo.OldWhiteCastleQueen = g->whiteCastleQueen; + undo.OldBlackCastleKing = g->blackCastleKing; + undo.OldBlackCastleQueen = g->blackCastleQueen; // play move Piece piece = g->pieces[PositionToIndex(move.From)]; @@ -184,7 +184,7 @@ UndoMove MakeMove(Move move, Game *g) { // 3 fold check uint64_t key = GenerateZobristKey(g); - undo.zobristKey = key; + undo.ZobristKey = key; g->ThreeFoldMap[key]++; @@ -218,10 +218,10 @@ void UnMakeMove(UndoMove undo, Game *g) { g->state = undo.oldState; - g->whiteCastleKing = undo.OldwhiteCastleKing; - g->whiteCastleQueen = undo.OldwhiteCastleQueen; - g->blackCastleKing = undo.OldblackCastleKing; - g->blackCastleQueen = undo.OldblackCastleQueen; + g->whiteCastleKing = undo.OldWhiteCastleKing; + g->whiteCastleQueen = undo.OldWhiteCastleQueen; + g->blackCastleKing = undo.OldBlackCastleKing; + g->blackCastleQueen = undo.OldBlackCastleQueen; if (undo.wasCastle) { if (undo.CastledSide) { @@ -247,8 +247,8 @@ void UnMakeMove(UndoMove undo, Game *g) { } } - g->ThreeFoldMap[undo.zobristKey] -= 1; - if (g->ThreeFoldMap[undo.zobristKey] <= 0) { - g->ThreeFoldMap.erase(undo.zobristKey); + g->ThreeFoldMap[undo.ZobristKey] -= 1; + if (g->ThreeFoldMap[undo.ZobristKey] <= 0) { + g->ThreeFoldMap.erase(undo.ZobristKey); }; }; diff --git a/src/board/board.hpp b/src/board/board.hpp index bd8efba..b35773d 100644 --- a/src/board/board.hpp +++ b/src/board/board.hpp @@ -18,12 +18,11 @@ enum GameState { TURN, WHITE_WON, BLACK_WON, - STALEMATE, DRAW, }; struct Piece { - bool color = 0; + bool color = false; PieceType type = NONEPIECE; }; @@ -35,7 +34,7 @@ struct Position { }; struct TranspositionsEntry { int depth; - float Eval; + int Eval; }; struct BitBoards { uint64_t whitePawns; @@ -54,7 +53,7 @@ struct BitBoards { }; struct Game { Piece pieces[64]; - bool turn = 1; // 1 white; 0 black + bool turn = true; // 1 white; 0 black bool whiteCastleKing = false; bool whiteCastleQueen = false; bool blackCastleKing = false; @@ -62,7 +61,7 @@ struct Game { uint8_t halfMoveClock = 0; uint16_t MoveClock = 0; Position enPassant; - bool canEnpassant = 0; + bool canEnpassant = false; GameState state = TURN; std::unordered_map<uint64_t, int> ThreeFoldMap; std::unordered_map<uint64_t, TranspositionsEntry> *Transpositions = nullptr; @@ -92,14 +91,14 @@ struct UndoMove { bool oldCanEnpassant; Position oldEnPassant; - bool OldwhiteCastleKing; - bool OldwhiteCastleQueen; - bool OldblackCastleKing; - bool OldblackCastleQueen; + bool OldWhiteCastleKing; + bool OldWhiteCastleQueen; + bool OldBlackCastleKing; + bool OldBlackCastleQueen; int oldHalfMoveClock; int oldMoveClock; - uint64_t zobristKey; + uint64_t ZobristKey; GameState oldState; // castling |
