From 1898add0142b70b3fef5af78a6f3d7399a3f2cd5 Mon Sep 17 00:00:00 2001 From: tslil Date: Wed, 16 Sep 2026 20:10:33 +0100 Subject: fix tt issue for non-self-play A little subtle, but in non-self-play games sharing tt entries is incorrect. We must therefore key additionally on the evaulation function itself. --- include/tt.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'include/tt.h') diff --git a/include/tt.h b/include/tt.h index 60b9b66..5834860 100644 --- a/include/tt.h +++ b/include/tt.h @@ -19,7 +19,7 @@ #define TT_H #include - +#include #include // =================================================================== @@ -35,6 +35,7 @@ enum TT_FLAG { TT_EXACT, TT_LOWERBOUND, TT_UPPERBOUND }; typedef struct tt_node_s { uint16_t gen; uint64_t key; + nn_function eval; enum TT_FLAG flag; uint8_t depth; float value; @@ -61,7 +62,7 @@ typedef struct tt_node_s { // entries are otherwise kept across plies on purpose (see negamax.c). int tt_init(void); -tt_entry_t *tt_seek(const uint64_t key); +tt_entry_t *tt_seek(const uint64_t key, const nn_function eval); // Store a search result for `key', returning the entry it was written to, or // NULL when the replacement policy keeps the current occupant instead. @@ -73,8 +74,8 @@ tt_entry_t *tt_seek(const uint64_t key); // - otherwise (empty slot, stale generation, or a different key): replace the // occupant unless it is a deeper search of a different position, which is // kept. -tt_entry_t *tt_store(const uint64_t key, const enum TT_FLAG flag, - const uint8_t depth, const float value, - const action_t action); +tt_entry_t *tt_store(const uint64_t key, const nn_function eval, + const enum TT_FLAG flag, const uint8_t depth, + const float value, const action_t action); #endif -- cgit v1.3.1