diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -640,6 +640,7 @@ Move iterative_deepening(int* board, int color, long hash, Transposition* transp clock_t deadline = start + MOVE_TIME * CLOCKS_PER_SEC; int alpha = -INFINITY; int beta = +INFINITY; + int window_size = 4; while (depth <= MAX_DEPTH) { best_move = move; @@ -658,10 +659,15 @@ Move iterative_deepening(int* board, int color, long hash, Transposition* transp index_to_notation(move.destination, move_in_notation + 2); printf("Done (%s with evaluation %.2f) [%i positions analyzed]\n", move_in_notation, (double)move.value / 10, metrics); - alpha = move.value - 3; - beta = move.value + 3; - - depth++; + if (move.value < alpha || move.value > beta) { + printf("Out of aspiration window, re-doing the full search\n"); + alpha = -INFINITY; + beta = +INFINITY; + } else { + alpha = move.value - window_size; + beta = move.value + window_size; + depth++; + } } printf("Max depth (%i) reached in %.2f seconds\n", MAX_DEPTH, (double)(clock() - start) / CLOCKS_PER_SEC); |