tune: repetition history set to 100 plies

This commit is contained in:
dogeystamp 2024-12-28 21:33:29 -05:00
parent ede46552fe
commit e27e18e482
No known key found for this signature in database

View File

@ -516,9 +516,8 @@ mod ringptr_tests {
/// Ring-buffer of previously seen hashes, used to avoid draw by repetition. /// 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. /// Only stores at most `HISTORY_SIZE` plies.
/// Technically, it should be 100 plies because of the 50-move rule. #[derive(Clone, Copy, Debug)]
#[derive(Default, Clone, Copy, Debug)]
struct BoardHistory { struct BoardHistory {
hashes: [Zobrist; HISTORY_SIZE], hashes: [Zobrist; HISTORY_SIZE],
/// Index of the start of the history in the buffer /// Index of the start of the history in the buffer
@ -527,6 +526,17 @@ struct BoardHistory {
ptr_end: RingPtr<HISTORY_SIZE>, ptr_end: RingPtr<HISTORY_SIZE>,
} }
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 { impl PartialEq for BoardHistory {
/// Always equal, since comparing two boards with different histories shouldn't matter. /// Always equal, since comparing two boards with different histories shouldn't matter.
fn eq(&self, _other: &Self) -> bool { fn eq(&self, _other: &Self) -> bool {
@ -539,7 +549,7 @@ impl Eq for BoardHistory {}
/// Size in plies of the board history. /// Size in plies of the board history.
/// ///
/// Actual capacity is one less than this. /// Actual capacity is one less than this.
const HISTORY_SIZE: usize = 15; const HISTORY_SIZE: usize = 100;
impl BoardHistory { impl BoardHistory {
/// Counts occurences of this hash in the history. /// Counts occurences of this hash in the history.