Implement redundant mailbox representation

This commit is contained in:
stefiosif
2024-09-19 22:57:03 +03:00
parent 3739e6e169
commit f74f1ef364
11 changed files with 252 additions and 132 deletions

View File

@@ -25,9 +25,13 @@ pub fn from_fen(fen: &str) -> Result<Game, FenError> {
halfmove_clock,
fullmove_counter,
));
let mailbox = Mailbox::new_from_board(&board);
Ok(Game {
board,
history: History::new(),
mailbox,
})
}
@@ -127,6 +131,7 @@ fn castling_ability(castling: &str) -> Result<[Castle; 2], FenError> {
use std::collections::HashMap;
use super::history::History;
use super::mailbox::Mailbox;
fn en_passant_square(square: &str) -> Result<Option<usize>, FenError> {
let mut sqr = square.chars();