tune: reduce board history size
seemingly avoiding repetition performs worse as of last commit.
This commit is contained in:
parent
db365c124e
commit
cac74a46cd
28
src/lib.rs
28
src/lib.rs
@ -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.
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user