Prepare some more variants (unfinished)
[vchess.git] / public / javascripts / variants / Magnetic.js
index 2e90e6c..8480d79 100644 (file)
@@ -1,9 +1,6 @@
 class MagneticRules extends ChessRules
 {
-       getEpSquare(move)
-       {
-               return undefined; //no en-passant
-       }
+       static get HasEnpassant() { return false; }
 
        getPotentialMovesFrom([x,y])
        {
@@ -154,8 +151,8 @@ class MagneticRules extends ChessRules
                this.play(move);
                // The only way to be "under check" is to have lost the king (thus game over)
                let res = this.kingPos[c][0] < 0
-                       ? [ JSON.parse(JSON.stringify(saveKingPos)) ]
-                       : [ ];
+                       ? [JSON.parse(JSON.stringify(saveKingPos))]
+                       : [];
                this.undo(move);
                return res;
        }
@@ -210,7 +207,10 @@ class MagneticRules extends ChessRules
                return this.turn == "w" ? "0-1" : "1-0";
        }
 
-       static get THRESHOLD_MATE() {
+       static get THRESHOLD_MATE()
+       {
                return 500; //checkmates evals may be slightly below 1000
        }
 }
+
+const VariantRules = MagneticRules;