import { randInt } from "@/utils/alea";
export class PocketknightRules extends ChessRules {
+
hoverHighlight(x, y) {
// Testing move validity results in an infinite update loop.
// TODO: find a way to test validity anyway.
);
}
+ canIplay(side, [x, y]) {
+ if (this.subTurn == 1) return super.canIplay(side, [x, y]);
+ // subturn == 2, drop the knight:
+ return side == this.turn && this.board[x][y] == V.EMPTY;
+ }
+
getPotentialMovesFrom([x, y]) {
if (this.subTurn == 1) {
let moves = super.getPotentialMovesFrom([x, y]);
// Knight landing:
return "N@" + V.CoordsToSquare(move.end);
}
+
};