// Modify capturing moves among listed pincer moves
addPincerCaptures(moves, byChameleon) {
const steps = this.pieces()['p'].moves[0].steps;
// Modify capturing moves among listed pincer moves
addPincerCaptures(moves, byChameleon) {
const steps = this.pieces()['p'].moves[0].steps;
getLeaperCaptures([x, y], byChameleon, onlyOne) {
// Look in every direction for captures
const steps = this.pieces()['r'].moves[0].steps;
getLeaperCaptures([x, y], byChameleon, onlyOne) {
// Look in every direction for captures
const steps = this.pieces()['r'].moves[0].steps;
[i, j] = [i + step[0], this.getY(j + step[1])];
while (this.onBoard(i, j) && this.board[i][j] == "") {
let mv = this.getBasicMove([x, y], [i, j]);
[i, j] = [i + step[0], this.getY(j + step[1])];
while (this.onBoard(i, j) && this.board[i][j] == "") {
let mv = this.getBasicMove([x, y], [i, j]);
getChameleonCaptures(moves, pushPullType, onlyOneJump) {
const [x, y] = [moves[0].start.x, moves[0].start.y];
moves = moves.concat(
getChameleonCaptures(moves, pushPullType, onlyOneJump) {
const [x, y] = [moves[0].start.x, moves[0].start.y];
moves = moves.concat(
- this.getKnightCaptures([x, y], "asChameleon", onlyOneJump));
+ this.getLeaperCaptures([x, y], "asChameleon", onlyOneJump));
// No "king capture" because king cannot remain under check
this.addPincerCaptures(moves, "asChameleon");
this.addCoordinatorCaptures(moves, "asChameleon");
// No "king capture" because king cannot remain under check
this.addPincerCaptures(moves, "asChameleon");
this.addCoordinatorCaptures(moves, "asChameleon");
// type: nothing (freely, capture all), or pull or push, or "exclusive"
addPushmePullyouCaptures(moves, byChameleon, type) {
// type: nothing (freely, capture all), or pull or push, or "exclusive"
addPushmePullyouCaptures(moves, byChameleon, type) {
const [sx, sy] = [moves[0].start.x, moves[0].start.y];
const adjacentSteps = this.pieces()['r'].moves[0].steps;
let capturingPullDir = {};
const [sx, sy] = [moves[0].start.x, moves[0].start.y];
const adjacentSteps = this.pieces()['r'].moves[0].steps;
let capturingPullDir = {};
- ex != x ? (ex - x) / Math.abs(ex - x) : 0,
- ey != y ? (ey - y) / Math.abs(ey - y) : 0
+ ex != sx ? (ex - sx) / Math.abs(ex - sx) : 0,
+ ey != sy ? (ey - sy) / Math.abs(ey - sy) : 0
vanishPull =
new PiPo({x: bi, y: bj, p: this.getPiece(bi, bj), c: oppCol});
}
vanishPull =
new PiPo({x: bi, y: bj, p: this.getPiece(bi, bj), c: oppCol});
}
// Generate all potential opponent moves, check if king captured.
// TODO: do it more efficiently.
const color = this.getColor(x, y);
for (let i = 0; i < this.size.x; i++) {
for (let j = 0; j < this.size.y; j++) {
if (
// Generate all potential opponent moves, check if king captured.
// TODO: do it more efficiently.
const color = this.getColor(x, y);
for (let i = 0; i < this.size.x; i++) {
for (let j = 0; j < this.size.y; j++) {
if (