-
- // If this code is reached, castle is valid
- let cmove = new Move({
- appear: [
- new PiPo({x:x,y:finalSquares[castleSide][0],p:V.KING,c:c}),
- new PiPo({x:x,y:finalSquares[castleSide][1],p:V.ROOK,c:c})],
- vanish: [
- new PiPo({x:x,y:y,p:V.KING,c:c}),
- new PiPo({x:x,y:rookPos,p:V.ROOK,c:c})],
- end: Math.abs(y - rookPos) <= 2
- ? {x:x, y:rookPos}
- : {x:x, y:y + 2 * (castleSide==0 ? -1 : 1)}
- });
- this.applyMagneticLaws([x,finalSquares[castleSide][1]], cmove);
- moves.push(cmove);