I'm using your crate (thank you for writing it!) for a chess engine and encountered the following problem: The Zobrist hash does not take into account which side is to move. This is vital information though, for instance this fails:
use chess::Board;
assert_ne!(
Board::from_fen("8/q7/1q6/2k5/5K2/6Q1/7Q/8 w - - 0 1".into()).unwrap().get_hash(),
Board::from_fen("8/q7/1q6/2k5/5K2/6Q1/7Q/8 b - - 0 1".into()).unwrap().get_hash());
However the first position is winning for white, the other is winning for black.
But–since both positions have the same hash–the transposition table gave nonsensical results, which confused my engine a lot.
(While we're at it: Is there a reason that from_fen takes a String and not a &str?)
I'm using your crate (thank you for writing it!) for a chess engine and encountered the following problem: The Zobrist hash does not take into account which side is to move. This is vital information though, for instance this fails:
However the first position is winning for white, the other is winning for black.
But–since both positions have the same hash–the transposition table gave nonsensical results, which confused my engine a lot.
(While we're at it: Is there a reason that
from_fen
takes aString
and not a&str
?)