[explorer] Print some question marks if a move is generated without target/origin squares
The move I observed in my testing was a castling move, which doesn't set target and origin squares because those are provided by the castling parameters struct from the board crate. Fix the missing squares on castle moves by looking up castling parameters and populating them. This requires Move::castle() to take a Color in addition to the Wing. Update all the call sites.
This commit is contained in:
parent
659ffb6130
commit
9815a63ebb
6 changed files with 27 additions and 16 deletions
|
@ -398,7 +398,7 @@ mod tests {
|
|||
|
||||
let original_castling_rights = board.castling_rights();
|
||||
|
||||
let ply = Move::castle(Wing::KingSide);
|
||||
let ply = Move::castle(Color::White, Wing::KingSide);
|
||||
let record = board.make_move(ply, ValidateMove::Yes)?;
|
||||
|
||||
// Verify castle was made
|
||||
|
@ -430,7 +430,7 @@ mod tests {
|
|||
|
||||
let original_castling_rights = board.castling_rights();
|
||||
|
||||
let ply = Move::castle(Wing::QueenSide);
|
||||
let ply = Move::castle(Color::White, Wing::QueenSide);
|
||||
let record = board.make_move(ply, ValidateMove::Yes)?;
|
||||
|
||||
// Verify castle was made
|
||||
|
@ -455,15 +455,14 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn unmake_black_kingside_castle() -> TestResult {
|
||||
let mut board = test_board![
|
||||
let mut board = test_board!(Black, [
|
||||
Black King on E8,
|
||||
Black Rook on H8,
|
||||
];
|
||||
board.set_active_color(Color::Black);
|
||||
]);
|
||||
|
||||
let original_castling_rights = board.castling_rights();
|
||||
|
||||
let ply = Move::castle(Wing::KingSide);
|
||||
let ply = Move::castle(Color::Black, Wing::KingSide);
|
||||
let record = board.make_move(ply, ValidateMove::Yes)?;
|
||||
|
||||
// Verify castle was made
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue