[explorer] Add a load command

Loads a board position from a FEN string.

Plumb through setting the Zobrist state on an existing board. Rebuild the hash
when setting the state.
This commit is contained in:
Eryn Wells 2025-06-08 16:49:55 -07:00
parent 428ace13dc
commit 634876822b
3 changed files with 47 additions and 1 deletions

View file

@ -306,6 +306,15 @@ impl Board {
zobrist.set_hash_value(new_hash);
}
}
pub fn zobrist_state(&self) -> Option<Arc<ZobristState>> {
self.zobrist_hash.as_ref().map(ZobristHash::state)
}
pub fn set_zobrist_state(&mut self, state: Arc<ZobristState>) {
self.zobrist_hash = Some(ZobristHash::new(state));
self.recompute_zobrist_hash();
}
}
impl Board {