findCaptures_aux([x, y], asA) {
    const color = this.getColor(x, y);
    let moves = [];
    const steps =
      asA != V.PAWN
        ? asA == V.QUEEN
          ? V.steps[V.ROOK].concat(V.steps[V.BISHOP])
          : V.steps[asA]
        : color == "w"
          ? [
            [-1, -1],
            [-1, 1]
          ]
          : [
            [1, -1],
            [1, 1]
          ];
    const oneStep = [V.KNIGHT,V.PAWN].includes(asA); //we don't capture king
    const lastRank = color == "w" ? 0 : V.size.x - 1;
    const promotionPieces = [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN];
    const oppCol = V.GetOppCol(color);
    outerLoop: for (let loop = 0; loop < steps.length; loop++) {
      const step = steps[loop];
      let i = x + step[0];
      let j = y + step[1];
      while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) {
        if (oneStep) continue outerLoop;
        i += step[0];
        j += step[1];
      }
      if (
        V.OnBoard(i, j) &&
        this.board[i][j] != V.EMPTY &&
        this.getColor(i, j) == oppCol &&
        this.getPiece(i, j) == asA
      ) {
        // eat!
        if (this.getPiece(x, y) == V.PAWN && i == lastRank) {
          // Special case of promotion:
          promotionPieces.forEach(p => {
            moves.push(this.getBasicMove([x, y], [i, j], { c: color, p: p }));
          });
        }
        else {
          // All other cases
          moves.push(this.getBasicMove([x, y], [i, j]));
        }
      }
    }
    return moves;
  }
// if met piece is opponent and same movement (asA): eat it!
if met piece is opponent and same movement (asA): eat it!
if met piece is opponent and same movement ( asA ) : eat it!
findCaptures_aux([x, y], asA) {
    const color = this.getColor(x, y);
    let moves = [];
    const steps =
      asA != V.PAWN
        ? asA == V.QUEEN
          ? V.steps[V.ROOK].concat(V.steps[V.BISHOP])
          : V.steps[asA]
        : color == "w"
          ? [
            [-1, -1],
            [-1, 1]
          ]
          : [
            [1, -1],
            [1, 1]
          ];
    const oneStep = [V.KNIGHT,V.PAWN].includes(asA); 
    const lastRank = color == "w" ? 0 : V.size.x - 1;
    const promotionPieces = [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN];
    const oppCol = V.GetOppCol(color);
    outerLoop: for (let loop = 0; loop < steps.length; loop++) {
      const step = steps[loop];
      let i = x + step[0];
      let j = y + step[1];
      while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) {
        if (oneStep) continue outerLoop;
        i += step[0];
        j += step[1];
      }
      if (
        V.OnBoard(i, j) &&
        this.board[i][j] != V.EMPTY &&
        this.getColor(i, j) == oppCol &&
        this.getPiece(i, j) == asA
      ) {
        if (this.getPiece(x, y) == V.PAWN && i == lastRank) {
          promotionPieces.forEach(p => {
            moves.push(this.getBasicMove([x, y], [i, j], { c: color, p: p }));
          });
        }
        else {
          moves.push(this.getBasicMove([x, y], [i, j]));
        }
      }
    }
    return moves;
  }
findCaptures_aux ( [ x , y ] , asA ) { const color = this . getColor ( x , y ) ; let moves = [ ] ; const steps = asA != V . PAWN ? asA == V . QUEEN ? V . steps [ V . ROOK ] . concat ( V . steps [ V . BISHOP ] ) : V . steps [ asA ] : color == "w" ? [ [ - 1 , - 1 ] , [ - 1 , 1 ] ] : [ [ 1 , - 1 ] , [ 1 , 1 ] ] ; const oneStep = [ V . KNIGHT , V . PAWN ] . includes ( asA ) ; const lastRank = color == "w" ? 0 : V . size . x - 1 ; const promotionPieces = [ V . ROOK , V . KNIGHT , V . BISHOP , V . QUEEN ] ; const oppCol = V . GetOppCol ( color ) ; outerLoop : for ( let loop = 0 ; loop < steps . length ; loop ++ ) { const step = steps [ loop ] ; let i = x + step [ 0 ] ; let j = y + step [ 1 ] ; while ( V . OnBoard ( i , j ) && this . board [ i ] [ j ] == V . EMPTY ) { if ( oneStep ) continue outerLoop ; i += step [ 0 ] ; j += step [ 1 ] ; } if ( V . OnBoard ( i , j ) && this . board [ i ] [ j ] != V . EMPTY && this . getColor ( i , j ) == oppCol && this . getPiece ( i , j ) == asA ) { if ( this . getPiece ( x , y ) == V . PAWN && i == lastRank ) { promotionPieces . forEach ( p => { moves . push ( this . getBasicMove ( [ x , y ] , [ i , j ] , { c : color , p : p } ) ) ; } ) ; } else { moves . push ( this . getBasicMove ( [ x , y ] , [ i , j ] ) ) ; } } } return moves ; }
if met piece is opponent and same movement (asA): eat it!
if met piece is opponent and same movement ( asA ) : eat it!
//we don't capture king // eat! // Special case of promotion: // All other cases