aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/board/board.cpp4
-rw-r--r--src/bot.cpp4
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) {