aboutsummaryrefslogtreecommitdiff
path: root/src/board/ttable.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-25 05:18:38 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-25 05:18:38 +0300
commit3522398f7a456b400dc48de4c202a013490cd4fc (patch)
treefab5655517165e403a0c0965377f38306cc2b155 /src/board/ttable.rs
parent46b862a25203cb492dd45ba1696a28338a42065b (diff)
downloadchessnost-3522398f7a456b400dc48de4c202a013490cd4fc.tar.gz
feat: use transposition table in negamax
Diffstat (limited to 'src/board/ttable.rs')
-rw-r--r--src/board/ttable.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/board/ttable.rs b/src/board/ttable.rs
new file mode 100644
index 0000000..3a103da
--- /dev/null
+++ b/src/board/ttable.rs
@@ -0,0 +1,25 @@
+use crate::moves::Move;
+
+/// https://www.chessprogramming.org/Node_Types
+#[derive(Debug, PartialEq, Clone, Copy)]
+pub enum NodeType {
+ /// Principal variation node - exact score
+ PV,
+ /// Fail-high
+ Cut,
+ /// Fail-low
+ All,
+}
+
+#[derive(Debug, PartialEq, Clone, Copy)]
+pub struct TranspositionTableItem {
+ /// Zobrist hash of this position
+ pub hash: u64,
+ pub best_move: Move,
+ pub depth: u8,
+ pub score: f32,
+ pub node_type: NodeType,
+}
+
+pub const TTABLE_SIZE: u64 = 2u64.pow(24);
+pub type TranspositionTable = Vec<Option<TranspositionTableItem>>;