export class XiangqiRules extends ChessRules {
+ static get Options() {
+ return null;
+ }
+
// NOTE (TODO?) scanKings() could be more efficient (in Jangqi too)
static get Monochrome() {
if (y > 0) steps.push([0, -1]);
if (y < 9) steps.push([0, 1]);
}
- return super.getSlideNJumpMoves([x, y], steps, "oneStep");
+ return super.getSlideNJumpMoves([x, y], steps, 1);
}
knightStepsFromRookStep(step) {
this.knightStepsFromRookStep(rookStep));
}
}
- return super.getSlideNJumpMoves([x, y], steps, "oneStep");
+ return super.getSlideNJumpMoves([x, y], steps, 1);
}
getPotentialElephantMoves([x, y]) {
// "out of board" checks delayed to next method
}
}
- return super.getSlideNJumpMoves([x, y], steps, "oneStep");
+ return super.getSlideNJumpMoves([x, y], steps, 1);
}
getPotentialAdvisorMoves([x, y]) {
if (y == 3) step = [-direction, 1];
else step = [-direction, -1];
}
- return super.getSlideNJumpMoves([x, y], [step], "oneStep");
+ return super.getSlideNJumpMoves([x, y], [step], 1);
}
// In the middle of the palace:
return (
- super.getSlideNJumpMoves([x, y], ChessRules.steps[V.BISHOP], "oneStep")
+ super.getSlideNJumpMoves([x, y], ChessRules.steps[V.BISHOP], 1)
);
}
if (x > (c == 'w' ? V.size.x - 3 : 0)) steps.push([-1, 0]);
if (y > 3) steps.push([0, -1]);
if (y < 5) steps.push([0, 1]);
- return super.getSlideNJumpMoves([x, y], steps, "oneStep");
+ return super.getSlideNJumpMoves([x, y], steps, 1);
}
// In the middle of the palace:
return (
- super.getSlideNJumpMoves([x, y], ChessRules.steps[V.ROOK], "oneStep")
+ super.getSlideNJumpMoves([x, y], ChessRules.steps[V.ROOK], 1)
);
}
// The pawn necessarily crossed the river (attack on king)
const shiftX = (color == 'w' ? 1 : -1); //shift from king
return super.isAttackedBySlideNJump(
- [x, y], color, V.PAWN, [[shiftX, 0], [0, 1], [0, -1]], "oneStep");
+ [x, y], color, V.PAWN, [[shiftX, 0], [0, 1], [0, -1]], 1);
}
knightStepsFromBishopStep(step) {
}
}
return (
- super.isAttackedBySlideNJump([x, y], color, V.KNIGHT, steps, "oneStep")
+ super.isAttackedBySlideNJump([x, y], color, V.KNIGHT, steps, 1)
);
}
getNotation(move) {
let notation = super.getNotation(move);
if (move.vanish.length == 2 && move.vanish[0].p == V.PAWN)
- notation = "P" + substr(notation, 1);
+ notation = "P" + notation.substr(1);
return notation;
}