Add Konane, (very) early drafts of Emergo/Fanorona/Yote/Gomoku, fix repetitions detec...
[vchess.git] / client / src / variants / Otage.js
index 6f408bb..742c6ee 100644 (file)
@@ -646,11 +646,19 @@ export class OtageRules extends ChessRules {
       if (!m.end.released) return true;
       // Check for repetitions:
       V.PlayOnBoard(this.board, m);
-      const newState = { piece: m.end.released, position: this.getBaseFen() };
+      const newState = {
+        piece: m.end.released,
+        square: { x: m.end.x, y: m.end.y },
+        position: this.getBaseFen()
+      };
       const repet =
         this.repetitions.some(r => {
           return (
             r.piece == newState.piece &&
+            (
+              r.square.x == newState.square.x &&
+              r.square.y == newState.square.y &&
+            ) &&
             r.position == newState.position
           );
         });
@@ -724,6 +732,7 @@ export class OtageRules extends ChessRules {
       this.repetitions.push(
         {
           piece: move.end.released,
+          square: { x: move.end.x, y: move.end.y },
           position: this.getBaseFen()
         }
       );