From cac74a46cdb47adbeb7e5f13ddedf22a64cb9cfb Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Wed, 25 Dec 2024 16:15:37 -0500 Subject: [PATCH] tune: reduce board history size seemingly avoiding repetition performs worse as of last commit. --- src/lib.rs | 28 ++++++++++++++-------------- src/search.rs | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5290b6f..5661445 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -496,19 +496,6 @@ impl Default for RingPtr { impl RingPtr {} -/// 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)] -struct BoardHistory { - hashes: [Zobrist; HISTORY_SIZE], - /// Index of the start of the history in the buffer - ptr_start: RingPtr, - /// Index one-past-the-end of the history in the buffer - ptr_end: RingPtr, -} - #[cfg(test)] mod ringptr_tests { use super::*; @@ -527,6 +514,19 @@ 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)] +struct BoardHistory { + hashes: [Zobrist; HISTORY_SIZE], + /// Index of the start of the history in the buffer + ptr_start: RingPtr, + /// Index one-past-the-end of the history in the buffer + ptr_end: RingPtr, +} + impl PartialEq for BoardHistory { /// Always equal, since comparing two boards with different histories shouldn't matter. fn eq(&self, _other: &Self) -> bool { @@ -539,7 +539,7 @@ impl Eq for BoardHistory {} /// Size in plies of the board history. /// /// Actual capacity is one less than this. -const HISTORY_SIZE: usize = 30; +const HISTORY_SIZE: usize = 10; impl BoardHistory { /// Counts occurences of this hash in the history. diff --git a/src/search.rs b/src/search.rs index 5c75f34..71b7b86 100644 --- a/src/search.rs +++ b/src/search.rs @@ -208,8 +208,8 @@ fn minmax(board: &mut Board, state: &mut EngineState, mm: MinmaxState) -> (Vec