Move make/unmake and History on Game

This commit is contained in:
stefiosif
2024-09-15 18:38:32 +03:00
parent 3383435af7
commit f128b35252
8 changed files with 172 additions and 159 deletions

View File

@@ -25,7 +25,10 @@ pub fn from_fen(fen: &str) -> Result<Game, FenError> {
halfmove_clock,
fullmove_counter,
));
Ok(Game { board })
Ok(Game {
board,
history: History::new(),
})
}
pub fn piece_placement(pieces: &str) -> Result<Board, FenError> {
@@ -123,6 +126,8 @@ fn castling_ability(castling: &str) -> Result<[Castle; 2], FenError> {
use std::collections::HashMap;
use super::history::History;
fn en_passant_square(square: &str) -> Result<Option<usize>, FenError> {
let mut sqr = square.chars();