Some fixes. Loser implemented. Draft Extinction,Crazyhouse,Switching
[vchess.git] / public / javascripts / variants / Grand.js
index db0543f..844d62c 100644 (file)
@@ -63,8 +63,8 @@ class GrandRules extends ChessRules
                const V = VariantRules;
                const [sizeX,sizeY] = VariantRules.size;
                const shift = (color == "w" ? -1 : 1);
-               const startRanks = (color == "w" ? [sizeY-2,sizeY-3] : [1,2]);
-               const lastRanks = (color == "w" ? [0,1,2] : [sizeY-1,sizeY-2,sizeY-3]);
+               const startRanks = (color == "w" ? [sizeX-2,sizeX-3] : [1,2]);
+               const lastRanks = (color == "w" ? [0,1,2] : [sizeX-1,sizeX-2,sizeX-3]);
 
                if (x+shift >= 0 && x+shift < sizeX && x+shift != lastRanks[0])
                {
@@ -171,9 +171,9 @@ class GrandRules extends ChessRules
                        || this.isAttackedBySlideNJump(sq, colors, V.CARDINAL, V.steps[V.KNIGHT], "oneStep");
        }
 
-       play(move, ingame)
+       updateVariables(move)
        {
-               super.play(move, ingame);
+               super.updateVariables(move);
                if (move.vanish.length==2 && move.appear.length==1
                        && move.vanish[1].p != VariantRules.PAWN)
                {
@@ -185,13 +185,12 @@ class GrandRules extends ChessRules
                }
        }
 
-       undo(move)
+       unupdateVariables(move)
        {
-               super.undo(move);
+               super.unupdateVariables(move);
                if (move.vanish.length==2 && move.appear.length==1
                        && move.vanish[1].p != VariantRules.PAWN)
                {
-                       // Capture: update this.captures
                        this.captures[move.vanish[1].c][move.vanish[1].p] =
                                Math.max(0, this.captures[move.vanish[1].c][move.vanish[1].p]-1);
                }