aboutsummaryrefslogtreecommitdiff
path: root/src/bot.cpp
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-07-30 14:19:22 +0200
committerAdam <adammegarules1@gmail.com>2026-07-30 14:19:22 +0200
commitbdb770f7b678591a1516ee2b987d5ba22d5cdb23 (patch)
tree9cc1540369370e7ac7047f784ad68b7f4c2985f9 /src/bot.cpp
parent117ca43c12d70585bf5842a177bbad505b23ea38 (diff)
default depth
Diffstat (limited to 'src/bot.cpp')
-rw-r--r--src/bot.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bot.cpp b/src/bot.cpp
index 621f3ea..908b418 100644
--- a/src/bot.cpp
+++ b/src/bot.cpp
@@ -10,6 +10,8 @@
#include <iostream>
#include <vector>
+const int DEFAULT_DEPTH = 4;
+
const int PAWN_VALUE = 100;
const int KNIGHT_VALUE = 320;
const int BISHOP_VALUE = 400;
@@ -126,6 +128,7 @@ std::vector<Move> GetSortedLegalMoves(Game *g) {
}
Move EngineGetBestMove(Game *b, int depth) {
+ int usedDepth = (depth != -1 ? depth : DEFAULT_DEPTH);
auto moves = GetSortedLegalMoves(b);
if (moves.size() == 0) {
std::cout << "Expected a position with legal moves";
@@ -140,7 +143,7 @@ Move EngineGetBestMove(Game *b, int depth) {
float alpha = -INFINITY;
float beta = INFINITY;
- float eval = minimax(depth - 1, b, alpha, beta);
+ float eval = minimax(usedDepth - 1, b, alpha, beta);
UnMakeMove(undo, b);
if (b->turn) {