+ getBasicMove([sx, sy], [ex, ey], tr) {
+ let mv = new Move({
+ appear: [
+ new PiPo({
+ x: ex,
+ y: ey,
+ c: tr ? tr.c : this.getColor(sx, sy),
+ p: tr ? tr.p : this.board[sx][sy].charAt(1)
+ })
+ ],
+ vanish: [
+ new PiPo({
+ x: sx,
+ y: sy,
+ c: this.getColor(sx, sy),
+ p: this.board[sx][sy].charAt(1)
+ })
+ ]
+ });
+
+ // The opponent piece disappears if we take it
+ if (this.board[ex][ey] != V.EMPTY) {
+ mv.vanish.push(
+ new PiPo({
+ x: ex,
+ y: ey,
+ c: this.getColor(ex, ey),
+ p: this.board[ex][ey].charAt(1)
+ })
+ );
+ // Pieces are revealed when they capture
+ if (Object.keys(V.HIDDEN_DECODE).includes(mv.appear[0].p))
+ mv.appear[0].p = V.HIDDEN_DECODE[mv.appear[0].p];
+ }
+ return mv;
+ }
+
+ // What are the king moves from square x,y ?
+ getPotentialKingMoves(sq) {
+ // No castling:
+ return this.getSlideNJumpMoves(
+ sq,
+ V.steps[V.ROOK].concat(V.steps[V.BISHOP]),
+ "oneStep"
+ );
+ }