p.
All pieces represent players on a field of some ball game,
- so they can move up to two squares only for a better realism.
+ so they can move up to three squares only for a better realism.
figure.diagram-container
.diagram.diag12
p.
Todas las piezas representan jugadores en un área de juego de pelota,
- entonces solo se mueven dos casillas como máximo para un mejor realismo.
+ entonces solo se mueven tres casillas como máximo para un mejor realismo.
figure.diagram-container
.diagram.diag12
p.
Toutes les pièces représentent des joueurs sur un terrain d'un certain
- jeu de ballon, donc elles ne se déplacent que de deux cases au maximum
+ jeu de ballon, donc elles ne se déplacent que de trois cases au maximum
pour un meilleur réalisme.
figure.diagram-container
return super.getPotentialMovesFrom([x, y]);
}
- // "Sliders": at most 2 steps
+ // "Sliders": at most 3 steps
getSlideNJumpMoves([x, y], steps, oneStep) {
let moves = [];
outerLoop: for (let step of steps) {
let stepCount = 1;
while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) {
moves.push(this.getBasicMove([x, y], [i, j]));
- if (oneStep || stepCount == 2) continue outerLoop;
+ if (oneStep || stepCount == 3) continue outerLoop;
i += step[0];
j += step[1];
stepCount++;
return true;
}
+ static IsGoodPosition(position) {
+ if (position.length == 0) return false;
+ const rows = position.split("/");
+ if (rows.length != V.size.x) return false;
+ for (let row of rows) {
+ let sumElts = 0;
+ for (let i = 0; i < row.length; i++) {
+ if (V.PIECES.includes(row[i].toLowerCase())) sumElts++;
+ else {
+ const num = parseInt(row[i]);
+ if (isNaN(num)) return false;
+ sumElts += num;
+ }
+ }
+ if (sumElts != V.size.y) return false;
+ }
+ return true;
+ }
+
static ParseFen(fen) {
const fenParts = fen.split(" ");
return Object.assign(
return true;
}
+ underCheck(color) {
+ if (this.kingPos[color][0] < 0)
+ // A king outside the board isn't under check
+ return false;
+ return this.isAttacked(this.kingPos[color], V.GetOppCol(color));
+ }
+
prePlay(move) {
super.prePlay(move);
if (move.vanish.length == 0) this.reserve[this.turn][move.appear[0].p]--;