aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bot.cpp5
-rw-r--r--src/uci.cpp2
2 files changed, 5 insertions, 2 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) {
diff --git a/src/uci.cpp b/src/uci.cpp
index e425cde..ef368b3 100644
--- a/src/uci.cpp
+++ b/src/uci.cpp
@@ -155,7 +155,7 @@ void Uci() {
stringstream ss(line);
string token;
- int depth = 4; // default depth
+ int depth = -1;
ss >> token; // go