summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 6abea38..25a6a2f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -609,16 +609,14 @@ Move minimax_search(int* board, int color, int depth, int alpha, int beta, int*
long move_hash = hash_after_move(move, board, zobrist_seed, hash);
int captured_piece = make_move(move, board);
- int relative_depth = MAX_DEPTH - depth;
-
- move.value = relative_depth > 0
- ? minimax_search(board, 1 - color, depth + 1, alpha, beta, metrics, hash, transposition_table, zobrist_seed).value
+ move.value = depth > 0
+ ? minimax_search(board, 1 - color, depth - 1, alpha, beta, metrics, hash, transposition_table, zobrist_seed).value
: evaluate_position(board, available_moves_count, color);
- if (transposition_table[move_hash].depth < relative_depth) {
+ if (transposition_table[move_hash].depth < depth) {
if (transposition_table[move_hash].depth == -1) TRANSPOSITION_TABLE_CARDINALITY++;
transposition_table[move_hash].value = move.value;
- transposition_table[move_hash].depth = relative_depth;
+ transposition_table[move_hash].depth = depth;
}
unmake_move(move, captured_piece, board);
@@ -670,7 +668,7 @@ int main() {
clock_t start, end;
int metrics = 0;
start = clock();
- move = minimax_search(board, color, 0, -INFINITY, +INFINITY, &metrics, hash, transposition_table, zobrist_seed);
+ move = minimax_search(board, color, MAX_DEPTH, -INFINITY, +INFINITY, &metrics, hash, transposition_table, zobrist_seed);
end = clock();
printf("[%i positions analyzed in %f seconds]\n", metrics, (double)(end - start) / CLOCKS_PER_SEC);
printf("[Transposition table cardinality: %i]\n", TRANSPOSITION_TABLE_CARDINALITY);