return Object.assign(
ChessRules.steps, //add camel moves:
{'c': [ [-3,-1],[-3,1],[-1,-3],[-1,3],[1,-3],[1,3],[3,-1],[3,1] ]}
);
}
return Object.assign(
ChessRules.steps, //add camel moves:
{'c': [ [-3,-1],[-3,1],[-1,-3],[-1,3],[1,-3],[1,3],[3,-1],[3,1] ]}
);
}
+ // There may be 2 enPassant squares (if pawn jump 3 squares)
+ getEnpassantFen()
+ {
+ const L = this.epSquares.length;
+ if (!this.epSquares[L-1])
+ return "-"; //no en-passant
+ let res = "";
+ this.epSquares[L-1].forEach(sq => {
+ res += V.CoordsToSquare(sq) + ",";
+ });
+ return res.slice(0,-1); //remove last comma
+ }
+
+ if (!moveOrSquare)
+ return undefined;
+ if (typeof moveOrSquare === "string")
+ {
+ const square = moveOrSquare;
+ if (square == "-")
+ return undefined;
+ let res = [];
+ square.split(",").forEach(sq => {
+ res.push(V.SquareToCoords(sq));
+ });
+ return res;
+ }
+ // Argument is a move:
+ const move = moveOrSquare;
const [sx,sy,ex] = [move.start.x,move.start.y,move.end.x];
const [sx,sy,ex] = [move.start.x,move.start.y,move.end.x];
return this.getPotentialWildebeestMoves([x,y]);
default:
return super.getPotentialMovesFrom([x,y])
return this.getPotentialWildebeestMoves([x,y]);
default:
return super.getPotentialMovesFrom([x,y])
- const V = VariantRules;
- const [sizeX,sizeY] = VariantRules.size;
+ const [sizeX,sizeY] = [V.size.x,V.size.y];
const shift = (color == "w" ? -1 : 1);
const startRanks = (color == "w" ? [sizeX-2,sizeX-3] : [1,2]);
const lastRank = (color == "w" ? 0 : sizeX-1);
const shift = (color == "w" ? -1 : 1);
const startRanks = (color == "w" ? [sizeX-2,sizeX-3] : [1,2]);
const lastRank = (color == "w" ? 0 : sizeX-1);
- let epStep = epsq.y - y;
- var enpassantMove = this.getBasicMove([x,y], [x+shift,y+epStep]);
+ var enpassantMove = this.getBasicMove([x,y], [x+shift,epsq.y]);
- return this.getSlideNJumpMoves(
- sq, VariantRules.steps[VariantRules.CAMEL], "oneStep");
+ return this.getSlideNJumpMoves(sq, V.steps[V.CAMEL], "oneStep");
return this.getSlideNJumpMoves(
sq, V.steps[V.KNIGHT].concat(V.steps[V.CAMEL]), "oneStep");
}
return this.getSlideNJumpMoves(
sq, V.steps[V.KNIGHT].concat(V.steps[V.CAMEL]), "oneStep");
}
isAttackedByCamel(sq, colors)
{
return this.isAttackedBySlideNJump(sq, colors,
isAttackedByCamel(sq, colors)
{
return this.isAttackedBySlideNJump(sq, colors,
return this.isAttackedBySlideNJump(sq, colors, V.WILDEBEEST,
V.steps[V.KNIGHT].concat(V.steps[V.CAMEL]), "oneStep");
}
return this.isAttackedBySlideNJump(sq, colors, V.WILDEBEEST,
V.steps[V.KNIGHT].concat(V.steps[V.CAMEL]), "oneStep");
}