X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAlice.js;h=e33cbdd7aed1823b1eb2f962a933b555b60deefd;hb=HEAD;hp=82ba6b79e03b2327a14da3735aa04e2cadd7f708;hpb=6e0f28425075e6d2d79cab6d30bca6ce6d55f19d;p=vchess.git diff --git a/client/src/variants/Alice.js b/client/src/variants/Alice.js index 82ba6b79..e33cbdd7 100644 --- a/client/src/variants/Alice.js +++ b/client/src/variants/Alice.js @@ -5,6 +5,7 @@ import { ArrayFun } from "@/utils/array"; // TODO? atLeastOneMove() would be more efficient if rewritten here // (less sideBoard computations) export class AliceRules extends ChessRules { + static get ALICE_PIECES() { return { s: "p", @@ -72,7 +73,7 @@ export class AliceRules extends ChessRules { if (['K','k','L','l'].includes(row[i])) kings[row[i]]++; if (V.PIECES.includes(row[i].toLowerCase())) sumElts++; else { - const num = parseInt(row[i]); + const num = parseInt(row[i], 10); if (isNaN(num)) return false; sumElts += num; } @@ -101,7 +102,7 @@ export class AliceRules extends ChessRules { this.kingPos["w"] = [i, k]; break; default: { - const num = parseInt(rows[i].charAt(j)); + const num = parseInt(rows[i].charAt(j), 10); if (!isNaN(num)) k += num - 1; } } @@ -168,7 +169,8 @@ export class AliceRules extends ChessRules { return false; } } - } else if (this.board[m.end.x][m.end.y] != V.EMPTY) { + } + else if (this.board[m.end.x][m.end.y] != V.EMPTY) { // Attempt to capture const piece = this.getPiece(m.end.x, m.end.y); if ( @@ -346,7 +348,7 @@ export class AliceRules extends ChessRules { } getNotation(move) { - if (move.appear.length == 2 && move.appear[0].p == V.KING) { + if (move.appear.length == 2) { if (move.end.y < move.start.y) return "0-0-0"; return "0-0"; } @@ -366,4 +368,5 @@ export class AliceRules extends ChessRules { notation += "=" + move.appear[0].p.toUpperCase(); return notation; } + };