Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chess_move: Remove "takes" validation for SAN
This change modifies the from_san parsing to fix an issue where un-annotated en passant (missing the `e.p.` suffix) is not found as a valid move. This bug stems from the fact that the SAN parser: * records if a proposed move is a capture by looking for the `x` character * matching the proposed move's capture status with whether each legal move is a capture, in a slightly buggy way - by detecting if the destination square holds a piece. En passant is the only capture type during which the destination square doesn't hold the captured piece. When the `e.p.` suffix is present in the input SAN move, this check is skipped; however, the check is not skipped when the suffix is not present, and such an en passant SAN input will fail to match its corresponding legal move. This change drops the check for takes. This will allow en passant SAN inputs to match their corresponding legal move, but it will also alias capture SAN inputs to a non-capture legal move (Nxf3 will be interpreted as Nf3 if Nf3 happens to be legal, rather than being rejected) and vice versa. Since this crate will only be used when we assume the SAN is valid, we don't care about this aliasing. Fixes: jordanbray#54
- Loading branch information