// TODO? atLeastOneMove() would be more efficient if rewritten here
// (less sideBoard computations)
export class AliceRules extends ChessRules {
+
static get ALICE_PIECES() {
return {
s: "p",
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;
}
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;
}
}
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 (
}
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";
}
notation += "=" + move.appear[0].p.toUpperCase();
return notation;
}
+
};