X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCheckered.js;h=f8176cd331b1efd595b71312729b6fcaf28c7b3b;hp=1f6750b98583923a2f9402fd0910ae028b662b6f;hb=0c3fe8a6c3e02af46e0bc646b40c1a0c420f9dcd;hpb=41c80bb63b85b2696d3925c10784c3d7bb5d2aa3 diff --git a/client/src/variants/Checkered.js b/client/src/variants/Checkered.js index 1f6750b9..f8176cd3 100644 --- a/client/src/variants/Checkered.js +++ b/client/src/variants/Checkered.js @@ -1,4 +1,9 @@ -class CheckeredRules extends ChessRules +// TODO: to detect oppositeMoves, we need last move --> encoded in FEN +// + local moves stack (for AlphaBeta) + lastMove (in FEN) + +import { ChessRules } from "@/base_rules"; + +export const VariantRules = class CheckeredRules extends ChessRules { static getPpath(b) { @@ -206,9 +211,12 @@ class CheckeredRules extends ChessRules this.pawnFlags[move.start.x==6 ? "w" : "b"][move.start.y] = false; } - checkGameEnd() + getCurrentScore() { - const color = this.turn; + if (this.atLeastOneMove()) // game not over + return "*"; + + const color = this.turn; // Artifically change turn, for checkered pawns this.turn = V.GetOppCol(this.turn); const res = this.isAttacked(this.kingPos[color], [V.GetOppCol(color),'c']) @@ -241,7 +249,7 @@ class CheckeredRules extends ChessRules { const randFen = ChessRules.GenRandInitFen(); // Add 16 pawns flags: - return randFen.replace(" w 1111", " w 11111111111111111111"); + return randFen.replace(" w 0 1111", " w 0 11111111111111111111"); } getFlagsFen()