X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCheckered1.js;h=2451f9b50c5e7bed349c43ea8361c545ea5f72a1;hb=d807470f965d4d60a7fe6e1320ac7dfd3f0ea03f;hp=fd0d68dffd39f9242432407b321ea8daf6b3d6f9;hpb=165530a519288327f3a6364a43f1b9e73d944a20;p=vchess.git diff --git a/client/src/variants/Checkered1.js b/client/src/variants/Checkered1.js index fd0d68df..2451f9b5 100644 --- a/client/src/variants/Checkered1.js +++ b/client/src/variants/Checkered1.js @@ -1,6 +1,7 @@ import { ChessRules, Move, PiPo } from "@/base_rules"; export class Checkered1Rules extends ChessRules { + static board2fen(b) { const checkered_codes = { p: "s", @@ -503,9 +504,14 @@ export class Checkered1Rules extends ChessRules { this.kingPos[c][1] = move.appear[0].y; } super.updateCastleFlags(move, piece); - // Does this move turn off a 2-squares pawn flag? - if ([1, 6].includes(move.start.x) && move.vanish[0].p == V.PAWN) + if ( + [1, 6].includes(move.start.x) && + move.vanish[0].p == V.PAWN && + Math.abs(move.end.x - move.start.x) == 2 + ) { + // This move turns off a 2-squares pawn flag this.pawnFlags[move.start.x == 6 ? "w" : "b"][move.start.y] = false; + } } this.cmoves.push(this.getCmove(move)); } @@ -678,4 +684,5 @@ export class Checkered1Rules extends ChessRules { notation += "=" + move.appear[0].p.toUpperCase(); return notation; } + };