tune: reduce board history size

seemingly avoiding repetition performs worse as of last commit.
This commit is contained in:
dogeystamp 2024-12-25 16:15:37 -05:00
parent db365c124e
commit cac74a46cd
No known key found for this signature in database
2 changed files with 16 additions and 16 deletions

View File

@ -496,19 +496,6 @@ impl<const N: usize> Default for RingPtr<N> {
impl<const N: usize> RingPtr<N> {}
/// 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<HISTORY_SIZE>,
/// Index one-past-the-end of the history in the buffer
ptr_end: RingPtr<HISTORY_SIZE>,
}
#[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<HISTORY_SIZE>,
/// Index one-past-the-end of the history in the buffer
ptr_end: RingPtr<HISTORY_SIZE>,
}
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.

View File

@ -208,8 +208,8 @@ fn minmax(board: &mut Board, state: &mut EngineState, mm: MinmaxState) -> (Vec<M
}
}
if board.history.count(board.zobrist) == 2 {
// draw by repetition
if !mm.quiesce && board.history.count(board.zobrist) == 1 {
// avoid draw by repetition
return (Vec::new(), SearchEval::Exact(0));
}