From 2ceec0ec299f93627fbe9a4e278cdb0d943e2b63 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Sat, 22 Feb 2020 11:50:41 +0100
Subject: [PATCH] Fix Benedict rules

---
 client/src/variants/Benedict.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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;
-- 
2.44.0