+ postPlay(move) {
+ const c = V.GetOppCol(this.turn);
+ const piece = move.appear[0].p;
+ // Update king position + flags
+ if (['k', 'a', 'e'].includes(piece)) {
+ this.kingPos[c][0] = move.appear[0].x;
+ this.kingPos[c][1] = move.appear[0].y;
+ this.castleFlags[c] = [V.size.y, V.size.y];
+ }
+ // Next call is still required because the king may eat an opponent's rook
+ // TODO: castleFlags will be turned off twice then.
+ super.updateCastleFlags(move, piece);
+ }
+
+ postUndo(move) {
+ // (Potentially) Reset king position
+ const c = this.getColor(move.start.x, move.start.y);
+ const piece = move.appear[0].p;
+ if (['k', 'a', 'e'].includes(piece))
+ this.kingPos[c] = [move.start.x, move.start.y];
+ }
+