Add TT cutoffs
This commit is contained in:
@@ -15,12 +15,10 @@ impl TranspositionTable {
|
||||
}
|
||||
|
||||
pub fn lookup(&self, zobrist_hash: ZobristHash) -> Option<&TTEntry> {
|
||||
let entry = self
|
||||
self
|
||||
.positions
|
||||
.get((zobrist_hash.0 % self.size) as usize)
|
||||
.and_then(|entry| entry.as_ref());
|
||||
|
||||
entry
|
||||
.and_then(|entry| entry.as_ref())
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, tt_entry: TTEntry) {
|
||||
@@ -33,14 +31,36 @@ impl TranspositionTable {
|
||||
pub struct TTEntry {
|
||||
pub hash: ZobristHash,
|
||||
pub mv: Option<Move>,
|
||||
pub depth: u8,
|
||||
pub score: i32,
|
||||
pub node_type: NodeType,
|
||||
}
|
||||
|
||||
impl TTEntry {
|
||||
pub const fn new(hash: ZobristHash, mv: Option<Move>) -> Self {
|
||||
Self { hash, mv }
|
||||
pub const fn new(
|
||||
hash: ZobristHash,
|
||||
mv: Option<Move>,
|
||||
depth: u8,
|
||||
score: i32,
|
||||
node_type: NodeType,
|
||||
) -> Self {
|
||||
Self {
|
||||
hash,
|
||||
mv,
|
||||
depth,
|
||||
score,
|
||||
node_type,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum NodeType {
|
||||
Exact,
|
||||
LowerBound,
|
||||
UpperBound,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{
|
||||
|
||||
Reference in New Issue
Block a user