From e27e18e482bad6de666be5f77e6feb181d5fdfa9 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sat, 28 Dec 2024 21:33:29 -0500 Subject: [PATCH] tune: repetition history set to 100 plies --- src/lib.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 03d1bb3..637c1df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -516,9 +516,8 @@ mod ringptr_tests { /// Ring-buffer of previously seen hashes, used to avoid draw by repetition. /// -/// Only stores at most `HISTORY_SIZE` plies, since most cases of repetition happen recently. -/// Technically, it should be 100 plies because of the 50-move rule. -#[derive(Default, Clone, Copy, Debug)] +/// Only stores at most `HISTORY_SIZE` plies. +#[derive(Clone, Copy, Debug)] struct BoardHistory { hashes: [Zobrist; HISTORY_SIZE], /// Index of the start of the history in the buffer @@ -527,6 +526,17 @@ struct BoardHistory { ptr_end: RingPtr, } +impl Default for BoardHistory { + fn default() -> Self { + BoardHistory { + // rust can't derive this + hashes: [Zobrist::default(); HISTORY_SIZE], + ptr_start: Default::default(), + ptr_end: Default::default(), + } + } +} + impl PartialEq for BoardHistory { /// Always equal, since comparing two boards with different histories shouldn't matter. fn eq(&self, _other: &Self) -> bool { @@ -539,7 +549,7 @@ impl Eq for BoardHistory {} /// Size in plies of the board history. /// /// Actual capacity is one less than this. -const HISTORY_SIZE: usize = 15; +const HISTORY_SIZE: usize = 100; impl BoardHistory { /// Counts occurences of this hash in the history.