findCaptures([x, y]) {
    const color = this.getColor(x, y);
    let moves = [];
    const steps = V.steps[V.ROOK].concat(V.steps[V.BISHOP]);
    const oppCol = V.GetOppCol(color);
    for (let loop = 0; loop < steps.length; loop++) {
      const step = steps[loop];
      let i = x + step[0];
      let j = y + step[1];
      let stepsAfter = 1;
      while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) {
        i += step[0];
        j += step[1];
        stepsAfter++;
      }
      if (
        V.OnBoard(i, j) &&
        this.board[i][j] != V.EMPTY &&
        this.getColor(i, j) == oppCol
      ) {
        const oppPiece = this.getPiece(i, j);
        if (
          (
            stepsAfter >= 2 &&
            [V.ROOK_S, V.BISHOP_S, V.QUEEN_S].includes(oppPiece)
          )
          ||
          (
            [V.BISHOP, V.BISHOP_S].includes(oppPiece) &&
            step.some(e => e == 0)
          )
          ||
          (
            [V.ROOK, V.ROOK_S].includes(oppPiece) &&
            step.every(e => e != 0)
          )
        ) {
          continue;
        }
        return true;
      }
    }
    return false;
  }
// Find possible captures by opponent on [x, y]
Find possible captures by opponent on [x, y]
Find possible captures by opponent on [ x y ]
findCaptures([x, y]) {
    const color = this.getColor(x, y);
    let moves = [];
    const steps = V.steps[V.ROOK].concat(V.steps[V.BISHOP]);
    const oppCol = V.GetOppCol(color);
    for (let loop = 0; loop < steps.length; loop++) {
      const step = steps[loop];
      let i = x + step[0];
      let j = y + step[1];
      let stepsAfter = 1;
      while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) {
        i += step[0];
        j += step[1];
        stepsAfter++;
      }
      if (
        V.OnBoard(i, j) &&
        this.board[i][j] != V.EMPTY &&
        this.getColor(i, j) == oppCol
      ) {
        const oppPiece = this.getPiece(i, j);
        if (
          (
            stepsAfter >= 2 &&
            [V.ROOK_S, V.BISHOP_S, V.QUEEN_S].includes(oppPiece)
          )
          ||
          (
            [V.BISHOP, V.BISHOP_S].includes(oppPiece) &&
            step.some(e => e == 0)
          )
          ||
          (
            [V.ROOK, V.ROOK_S].includes(oppPiece) &&
            step.every(e => e != 0)
          )
        ) {
          continue;
        }
        return true;
      }
    }
    return false;
  }
findCaptures ( [ x , y ] ) { const color = this . getColor ( x , y ) ; let moves = [ ] ; const steps = V . steps [ V . ROOK ] . concat ( V . steps [ V . BISHOP ] ) ; const oppCol = V . GetOppCol ( color ) ; for ( let loop = 0 ; loop < steps . length ; loop ++ ) { const step = steps [ loop ] ; let i = x + step [ 0 ] ; let j = y + step [ 1 ] ; let stepsAfter = 1 ; while ( V . OnBoard ( i , j ) && this . board [ i ] [ j ] == V . EMPTY ) { i += step [ 0 ] ; j += step [ 1 ] ; stepsAfter ++ ; } if ( V . OnBoard ( i , j ) && this . board [ i ] [ j ] != V . EMPTY && this . getColor ( i , j ) == oppCol ) { const oppPiece = this . getPiece ( i , j ) ; if ( ( stepsAfter >= 2 && [ V . ROOK_S , V . BISHOP_S , V . QUEEN_S ] . includes ( oppPiece ) ) || ( [ V . BISHOP , V . BISHOP_S ] . includes ( oppPiece ) && step . some ( e => e == 0 ) ) || ( [ V . ROOK , V . ROOK_S ] . includes ( oppPiece ) && step . every ( e => e != 0 ) ) ) { continue ; } return true ; } } return false ; }
Find possible captures by opponent on [x, y]
Find possible captures by opponent on [ x y ]