1
0
Fork 0

check, mate & en passant methods

This commit is contained in:
Paul-Nicolas Madelaine 2025-11-13 23:10:22 +01:00
parent 098071046d
commit d66828c861
4 changed files with 115 additions and 20 deletions

View file

@ -61,7 +61,12 @@ fn recursive_check_aux(position: Position, depth: usize) {
match depth.checked_sub(1) {
None => (),
Some(depth) => {
position.legal_moves().into_iter().for_each(|m| {
let moves = position.legal_moves();
assert_eq!(moves.len(), position.count_legal_moves());
assert_eq!(moves.is_check(), position.is_check());
assert_eq!(moves.is_mate(), position.is_mate());
assert_eq!(moves.en_passant_is_legal(), position.en_passant_is_legal());
moves.into_iter().for_each(|m| {
let uci = m.to_uci();
assert_eq!(uci, uci.to_move(&position).unwrap().to_uci());
let san: San = m.to_san();