- unupdateVariables(move)
- {
- super.unupdateVariables(move);
- const c = move.vanish[0].c;
- const oppCol = V.GetOppCol(c);
- if (this.kingPos[oppCol][0] < 0)
- {
- // Last move took opponent's king
- for (let psq of move.vanish)
- {
- if (psq.p == 'k')
- {
- this.kingPos[oppCol] = [psq.x, psq.y];
- break;
- }
- }
- }
+ postUndo(move) {
+ super.postUndo(move);
+ if (move.vanish.length == 2 && move.vanish[1].p == V.KING)
+ // Last move took opponent's king:
+ this.kingPos[move.vanish[1].c] = [move.vanish[1].x, move.vanish[1].y];