// Avoid "oppMoves = this.getAllValidMoves();" => infinite recursion
outerLoop: for (let i=0; i<V.size.x; i++) {
for (let j=0; j<V.size.y; j++) {
// Avoid "oppMoves = this.getAllValidMoves();" => infinite recursion
outerLoop: for (let i=0; i<V.size.x; i++) {
for (let j=0; j<V.size.y; j++) {
// If this code is reached, rooks and king are on initial position
// Nothing on the path of the king ? (and no checks)
// If this code is reached, rooks and king are on initial position
// Nothing on the path of the king ? (and no checks)
// Nothing on final squares, except maybe king and castling rook?
for (i = 0; i < 2; i++) {
// Nothing on final squares, except maybe king and castling rook?
for (i = 0; i < 2; i++) {
// Did opponent king disappeared?
if (v.p == V.KING)
this.kingPos[this.turn] = [-1, -1];
// Or maybe a rook?
else if (v.p == V.ROOK) {
if (v.y < this.INIT_COL_KING[v.c])
// Did opponent king disappeared?
if (v.p == V.KING)
this.kingPos[this.turn] = [-1, -1];
// Or maybe a rook?
else if (v.p == V.ROOK) {
if (v.y < this.INIT_COL_KING[v.c])