Some fixes. Screen variant computer play is still broken, seemingly
[vchess.git] / client / src / variants / Zen.js
index 808d543..7edbe40 100644 (file)
@@ -1,6 +1,7 @@
 import { ChessRules } from "@/base_rules";
 
 export class ZenRules extends ChessRules {
+
   getEpSquare(moveOrSquare) {
     if (!moveOrSquare) return undefined;
     if (typeof moveOrSquare === "string") {
@@ -78,6 +79,7 @@ export class ZenRules extends ChessRules {
       }
       if (
         V.OnBoard(i, j) &&
+        this.board[i][j] != V.EMPTY &&
         this.getColor(i, j) == oppCol &&
         this.getPiece(i, j) == asA
       ) {
@@ -87,7 +89,8 @@ export class ZenRules extends ChessRules {
           promotionPieces.forEach(p => {
             moves.push(this.getBasicMove([x, y], [i, j], { c: color, p: p }));
           });
-        } else {
+        }
+        else {
           // All other cases
           moves.push(this.getBasicMove([x, y], [i, j]));
         }
@@ -161,4 +164,5 @@ export class ZenRules extends ChessRules {
       k: 1000
     };
   }
+
 };