- moves.forEach(m => {
- if (m.vanish[0].p == 's' && m.appear[0].p != 's') {
- // Promotion pieces should be non-violent as well:
- const pIdx = ChessRules.PIECES.findIndex(p => p == m.appear[0].p)
- m.appear[0].p = V.NON_VIOLENT[pIdx];
- }
- });
+ if (moves.length > 0 && moves[0].vanish[0].p == 's') {
+ // Remove captures for non-violent pawns:
+ moves = moves.filter(m => m.vanish.length == 1);
+ moves.forEach(m => {
+ if (m.appear[0].p != 's') {
+ // Promotion pieces should be non-violent as well:
+ const pIdx = ChessRules.PIECES.findIndex(p => p == m.appear[0].p)
+ m.appear[0].p = V.NON_VIOLENT[pIdx];
+ }
+ });
+ }