);
}
- static GenRandInitFen(randomness) {
- const antikingFen = Antiking2Rules.GenRandInitFen(randomness);
+ static GenRandInitFen(options) {
+ const antikingFen = Antiking2Rules.GenRandInitFen(options);
return antikingFen.replace('a', 'J').replace('A', 'j');
}
getPotentialJokerMoves([x, y]) {
const moving =
- super.getSlideNJumpMoves([x, y], V.steps[V.KNIGHT], "oneStep")
+ super.getSlideNJumpMoves([x, y], V.steps[V.KNIGHT], 1)
.concat(super.getSlideNJumpMoves([x, y],
V.steps[V.ROOK].concat(V.steps[V.BISHOP])));
let swapping = [];
// Following test is OK because only one Joker on board at a time
if (this.board[i][j] != V.EMPTY && this.getColor(i, j) == c) {
const p = this.getPiece(i, j);
- swapping.push(
- new Move({
- vanish: [
- new PiPo({ x: x, y: y, c: c, p: V.JOKER }),
- new PiPo({ x: i, y: j, c: c, p: p })
- ],
- appear: [
- new PiPo({ x: i, y: j, c: c, p: V.JOKER }),
- new PiPo({ x: x, y: y, c: c, p: p })
- ]
- })
- );
+ const lastRank = (c == 'w' ? 0 : 7);
+ if (p != V.KING && (p != V.PAWN || x != lastRank)) {
+ swapping.push(
+ new Move({
+ vanish: [
+ new PiPo({ x: x, y: y, c: c, p: V.JOKER }),
+ new PiPo({ x: i, y: j, c: c, p: p })
+ ],
+ appear: [
+ new PiPo({ x: i, y: j, c: c, p: V.JOKER }),
+ new PiPo({ x: x, y: y, c: c, p: p })
+ ]
+ })
+ );
+ }
}
}
}