);
}
- static GenRandInitFen(randomness) {
+ static GenRandInitFen(options) {
return (
- ChessRules.GenRandInitFen(randomness).slice(0, -2) +
+ ChessRules.GenRandInitFen(options).slice(0, -2) +
// Add pieceFlags + pocket
"1111111111111111 - 1111"
);
getPotentialHawkMoves(sq) {
return this.getSlideNJumpMoves(sq, V.steps[V.BISHOP]).concat(
- this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep")
+ this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], 1)
);
}
getPotentialElephantMoves(sq) {
return this.getSlideNJumpMoves(sq, V.steps[V.ROOK]).concat(
- this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep")
+ this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], 1)
);
}
isAttackedByHawk(sq, color) {
return (
this.isAttackedBySlideNJump(sq, color, V.HAWK, V.steps[V.BISHOP]) ||
- this.isAttackedBySlideNJump(
- sq,
- color,
- V.HAWK,
- V.steps[V.KNIGHT],
- "oneStep"
- )
+ this.isAttackedBySlideNJump(sq, color, V.HAWK, V.steps[V.KNIGHT], 1)
);
}
isAttackedByElephant(sq, color) {
return (
this.isAttackedBySlideNJump(sq, color, V.ELEPHANT, V.steps[V.ROOK]) ||
- this.isAttackedBySlideNJump(
- sq,
- color,
- V.ELEPHANT,
- V.steps[V.KNIGHT],
- "oneStep"
- )
+ this.isAttackedBySlideNJump(sq, color, V.ELEPHANT, V.steps[V.KNIGHT], 1)
);
}
static get VALUES() {
return Object.assign(
- {},
- ChessRules.VALUES,
- { 'h': 5, 'e': 7 }
+ {
+ 'h': 5,
+ 'e': 7
+ },
+ ChessRules.VALUES
);
}
const nothingAppear = (move.appear[0].p == V.NOTHING);
if (pPieceAppear || nothingAppear) {
let suffix = "";
- if (pPieceAppear) suffix = "/" + move.appear[0].p.toUpperCase();
+ if (pPieceAppear) {
+ suffix = "/" + move.appear[0].p.toUpperCase();
+ if (move.appear.length == 3) {
+ // Castling; indicate square
+ suffix +=
+ V.CoordsToSquare({ x: move.appear[0].x, y: move.appear[0].y });
+ }
+ }
let cmove = JSON.parse(JSON.stringify(move));
cmove.appear.shift();
return super.getNotation(cmove) + suffix;