summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 5107338..aa520b1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -12,6 +12,8 @@
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+int TRANSPOSITION_TABLE_CARDINALITY = 0;
+
void generate_zobrist_seed(long* seed) {
for (int i = 0; i < MAX_ZOBRIST_SEEDS; i++) {
seed[i] = rand();
@@ -576,6 +578,7 @@ Move minimax_search(int* board, int color, int depth, int alpha, int beta, int*
? 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 % TRANSPOSITION_TABLE_SIZE]) TRANSPOSITION_TABLE_CARDINALITY++;
transposition_table[move_hash % TRANSPOSITION_TABLE_SIZE] = move.value;
unmake_move(move, captured_piece, board);
@@ -626,6 +629,7 @@ int main() {
move = minimax_search(board, color, 0, -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);
char move_in_notation[] = "xy XY";
index_to_notation(move.origin, move_in_notation);