- 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 })
+ ]
+ })
+ );
+ }