From 266fba4a233d57b79a31b56933333fd672ad0a9d Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Thu, 9 Apr 2020 10:10:11 +0200
Subject: [PATCH] Fix Dynamo test for opposite moves

---
 client/src/variants/Dynamo.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/client/src/variants/Dynamo.js b/client/src/variants/Dynamo.js
index afa9a88f..57af913d 100644
--- a/client/src/variants/Dynamo.js
+++ b/client/src/variants/Dynamo.js
@@ -564,7 +564,6 @@ export class DynamoRules extends ChessRules {
   // Does m2 un-do m1 ? (to disallow undoing actions)
   oppositeMoves(m1, m2) {
     const isEqual = (av1, av2) => {
-      // Precondition: av1 and av2 length = 2
       for (let av of av1) {
         const avInAv2 = av2.find(elt => {
           return (
@@ -578,11 +577,12 @@ export class DynamoRules extends ChessRules {
       }
       return true;
     };
+    // All appear and vanish arrays must have the same length
+    const mL = m1.appear.length;
     return (
-      m1.appear.length == 2 &&
-      m2.appear.length == 2 &&
-      m1.vanish.length == 2 &&
-      m2.vanish.length == 2 &&
+      m2.appear.length == mL &&
+      m1.vanish.length == mL &&
+      m2.vanish.length == mL &&
       isEqual(m1.appear, m2.vanish) &&
       isEqual(m1.vanish, m2.appear)
     );
-- 
2.44.0