- this.kingPos[c] = [-1,-1];
- this.flags[c] = [false,false];
- }
-
- // Did we explode opponent king ?
- if (Math.abs(this.kingPos[oppCol][0]-move.end.x) <= 1
- && Math.abs(this.kingPos[oppCol][1]-move.end.y) <= 1)
- {
- this.kingPos[oppCol] = [-1,-1];
- this.flags[oppCol] = [false,false];
- }
- else
- {
- // Now check if opponent init rook(s) exploded
- if (Math.abs(move.end.x-oppFirstRank) <= 1)
+ // Did we explode king of color c ? (TODO: remove move earlier)
+ if (Math.abs(this.kingPos[c][0]-move.end.x) <= 1
+ && Math.abs(this.kingPos[c][1]-move.end.y) <= 1)
+ {
+ this.kingPos[c] = [-1,-1];
+ this.castleFlags[c] = [false,false];
+ }
+ else