aboutsummaryrefslogtreecommitdiff
path: root/include/zobrist.h
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-09-08 11:55:28 +0100
committertslil <tslil@posteo.de>2026-09-09 21:45:17 +0100
commit1c9e266ae25f7f6067806d139e5971ce8513d2f6 (patch)
tree9b935954310a56ee7fdba07db5f03888fc5af7b0 /include/zobrist.h
parent7ef68374e8a58684b299b0f46f7ed850d5a87190 (diff)
~25% speedup in selfplay due to: incremental zobrist hashing, smarter road checking, re-using the input computed for the NN
Diffstat (limited to 'include/zobrist.h')
-rw-r--r--include/zobrist.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/zobrist.h b/include/zobrist.h
index 5fd5ace..27053a6 100644
--- a/include/zobrist.h
+++ b/include/zobrist.h
@@ -19,8 +19,14 @@
#include <tak.h>
#include <xorshift64.h>
+#define PLY_PARITY_MAGIC 0x9E3779B97F4A7C15ULL
+
void zobrist_free(void);
int zobrist_init(const uint8_t board_size);
+// hash for whole state
uint64_t zobrist_compute(tak_state_p state);
+
+// hash contribution from a single board cell at location l
+uint64_t zobrist_cell(tak_state_p state, const uint8_t l);