X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FGrand.js;h=f4a96ce17256d3d42be225f5ec46944f28622fc8;hp=d4f620f7596d2c8bfe08e374501e21f047b443c6;hb=a68362420a3a92099dfaacea10f6cbd579161183;hpb=68e19a449db7a12e0a168e99cd750d985c983ba1 diff --git a/client/src/variants/Grand.js b/client/src/variants/Grand.js index d4f620f7..f4a96ce1 100644 --- a/client/src/variants/Grand.js +++ b/client/src/variants/Grand.js @@ -4,7 +4,7 @@ import { randInt } from "@/utils/alea"; // NOTE: initial setup differs from the original; see // https://www.chessvariants.com/large.dir/freeling.html -export const VariantRules = class GrandRules extends ChessRules { +export class GrandRules extends ChessRules { static IsGoodFen(fen) { if (!ChessRules.IsGoodFen(fen)) return false; const fenParsed = V.ParseFen(fen); @@ -87,12 +87,15 @@ export const VariantRules = class GrandRules extends ChessRules { return { x: 10, y: 10 }; } + // Rook + knight: static get MARSHALL() { return "m"; - } //rook+knight + } + + // Bishop + knight static get CARDINAL() { return "c"; - } //bishop+knight + } static get PIECES() { return ChessRules.PIECES.concat([V.MARSHALL, V.CARDINAL]); @@ -223,7 +226,7 @@ export const VariantRules = class GrandRules extends ChessRules { for (let epsq of epSquare) { // TODO: some redundant checks if (epsq.x == x + shiftX && Math.abs(epsq.y - y) == 1) { - var enpassantMove = this.getBasicMove([x, y], [epsq.x, epsq.y]); + let enpassantMove = this.getBasicMove([x, y], [epsq.x, epsq.y]); // WARNING: the captured pawn may be diagonally behind us, // if it's a 3-squares jump and we take on 1st passing square const px = this.board[x][epsq.y] != V.EMPTY ? x : x - shiftX;