From: Benjamin Auder Date: Sat, 22 Feb 2020 10:50:41 +0000 (+0100) Subject: Fix Benedict rules X-Git-Url: https://git.auder.net/variants/current/doc/css/img/cross.svg?a=commitdiff_plain;h=2ceec0ec299f93627fbe9a4e278cdb0d943e2b63;p=vchess.git Fix Benedict rules --- diff --git a/client/src/variants/Benedict.js b/client/src/variants/Benedict.js index fbeef895..8ce7acde 100644 --- a/client/src/variants/Benedict.js +++ b/client/src/variants/Benedict.js @@ -140,9 +140,9 @@ export const VariantRules = class BenedictRules extends ChessRules { // Get all moves from x,y without captures: let moves = super.getPotentialMovesFrom([x, y]); // Add flips: - let newAppear = []; - let newVanish = []; moves.forEach(m => { + let newAppear = []; + let newVanish = []; V.PlayOnBoard(this.board, m); // If castling, m.appear has 2 elements: m.appear.forEach(a => { @@ -164,9 +164,9 @@ export const VariantRules = class BenedictRules extends ChessRules { newAppear.push(pipoA); newVanish.push(pipoV); }); - Array.prototype.push.apply(m.appear, newAppear); - Array.prototype.push.apply(m.vanish, newVanish); }); + Array.prototype.push.apply(m.appear, newAppear); + Array.prototype.push.apply(m.vanish, newVanish); V.UndoOnBoard(this.board, m); }); return moves;