diff options
| author | Adam <adammegarules1@gmail.com> | 2026-07-31 10:07:01 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-07-31 10:07:01 +0200 |
| commit | 17f245ac325cea859fb39799a9c8b088fc933808 (patch) | |
| tree | 2406f5099ebe97c179e2cceb67a2b84e187e9fe5 /src | |
| parent | 32e11f19de1c602781f9a41fd6a3e31257860984 (diff) | |
improving default depth
Diffstat (limited to 'src')
| -rw-r--r-- | src/board/board.cpp | 4 | ||||
| -rw-r--r-- | src/bot.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/board/board.cpp b/src/board/board.cpp index d0cf4c1..92d448d 100644 --- a/src/board/board.cpp +++ b/src/board/board.cpp @@ -13,11 +13,11 @@ Piece createPiece(PieceType type, bool color) { int PositionToIndex(Position i) { return i.rank * 8 + i.file; } -Position FindKing(Game *b, bool white) { +Position FindKing(Game *b, bool color) { for (int i = 0; i < 64; i++) { Piece piece = b->pieces[i]; - if (piece.type == KING && piece.color == white) { + if (piece.type == KING && piece.color == color) { return IndexToPosition(i); } } diff --git a/src/bot.cpp b/src/bot.cpp index 61c38fa..982a4a4 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -129,7 +129,6 @@ std::vector<Move> GetSortedLegalMoves(Game *g, bool generateQuietMoves) { } Move EngineGetBestMove(Game *b, const int depth) { - const int usedDepth = (depth != -1 ? depth : DEFAULT_DEPTH); const auto moves = GetSortedLegalMoves(b); if (moves.empty()) { std::cout << "Expected a position with legal moves"; @@ -145,7 +144,8 @@ Move EngineGetBestMove(Game *b, const int depth) { const float alpha = -INFINITY; const float beta = INFINITY; - const int eval = minimax(usedDepth - 1, b, alpha, beta); + const int eval = + minimax(depth <= 0 ? DEFAULT_DEPTH : depth, b, alpha, beta); UnMakeMove(undo, b); if (b->turn) { |
