From 1c9e266ae25f7f6067806d139e5971ce8513d2f6 Mon Sep 17 00:00:00 2001 From: tslil Date: Tue, 8 Sep 2026 11:55:28 +0100 Subject: ~25% speedup in selfplay due to: incremental zobrist hashing, smarter road checking, re-using the input computed for the NN --- include/negamax.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/negamax.c') diff --git a/include/negamax.c b/include/negamax.c index 6c29481..c86eeab 100644 --- a/include/negamax.c +++ b/include/negamax.c @@ -100,6 +100,7 @@ float negamax_generate(tak_state_p state) { // this is constant across iterative deepening const uint64_t root_hash = zobrist_compute(state); + state->hash = root_hash; // anchor the incremental hash at the root #ifdef RECORD_PV pv_leaf_t iteration_leaf; #endif @@ -197,7 +198,7 @@ static float negamax(tak_state_p state, const uint8_t cur_depth, action_take(state, actions[idx]); - const uint64_t child_hash = zobrist_compute(state); + const uint64_t child_hash = state->hash; // Compute the value of the node and retain the leaf that produced it. float node_value; -- cgit v1.3.1