Add Zobrist hashing

This commit is contained in:
stefiosif
2024-10-06 03:31:33 +03:00
parent 70ba30ba1a
commit 28409d203a
8 changed files with 340 additions and 20 deletions

View File

@@ -27,11 +27,13 @@ pub fn from_fen(fen: &str) -> Result<Game, FenError> {
));
let mailbox = Mailbox::new_from_board(&board);
let hash = zobrist_keys().calculate_hash(&board);
Ok(Game {
board,
history: History::new(),
mailbox,
hash,
})
}
@@ -132,6 +134,7 @@ use std::collections::HashMap;
use super::history::History;
use super::mailbox::Mailbox;
use super::zobrist::zobrist_keys;
fn en_passant_square(square: &str) -> Result<Option<usize>, FenError> {
let mut sqr = square.chars();