}
}
- undo(move)
+ unupdateVariables(move)
{
- super.undo(move);
-
+ super.unupdateVariables(move);
const c = this.getColor(move.start.x,move.start.y);
const oppCol = this.getOppCol(c);
if ([this.kingPos[c][0],this.kingPos[oppCol][0]].some(e => { return e < 0; }))
return res;
}
+ getCheckSquares(move, c)
+ {
+ const saveKingPos = this.kingPos[c]; //king might explode
+ this.play(move);
+ let res = [ ];
+ if (this.kingPos[c][0] < 0)
+ res = [saveKingPos];
+ else if (this.isAttacked(this.kingPos[c], this.getOppCol(c)))
+ res = [ this.kingPos[c] ]
+ this.undo(move);
+ return res;
+ }
+
checkGameEnd(color)
{
const kp = this.kingPos[color];