From: Fabian Fichter Date: Fri, 9 Nov 2018 21:43:31 +0000 (+0100) Subject: Fix pseudo-legal move validation (resolves #12) X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=7f2056905e0808df42b7388e26d48ee16b0f0b72;p=fairystockfish.git Fix pseudo-legal move validation (resolves #12) For pieces which move and capture in different ways, the pseudo-legal move validation needs to take into account whether a move is a capture or not. This fixes the pseudo-legal move validation for breakthrough and hoppelpoppel. breakthrough ELO: 372.25 +-109.6 (95%) LOS: 100.0% Total: 100 W: 86 L: 7 D: 7 hoppelpoppel ELO: 530.72 +-154.4 (95%) LOS: 100.0% Total: 100 W: 92 L: 1 D: 7 --- diff --git a/src/position.cpp b/src/position.cpp index e14ca16..ecf827c 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -843,7 +843,7 @@ bool Position::pseudo_legal(const Move m) const { && double_step_enabled())) return false; } - else if (!(attacks_from(us, type_of(pc), from) & to)) + else if (!((capture(m) ? attacks_from(us, type_of(pc), from) : moves_from(us, type_of(pc), from)) & to)) return false; // Evasions generator already takes care to avoid some kind of illegal moves