findCaptures([x, y]) {
    const color = this.getColor(x, y);
    const piece = this.getPiece(x, y);
    let squares = [];
    const steps =
      piece != V.PAWN
        ? [V.QUEEN,V.KING].includes(piece)
          ? V.steps[V.ROOK].concat(V.steps[V.BISHOP])
          : V.steps[piece]
        : color == "w"
          ? [
            [-1, -1],
            [-1, 1]
          ]
          : [
            [1, -1],
            [1, 1]
          ];
    const oneStep = [V.KNIGHT,V.PAWN,V.KING].includes(piece);
    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.getColor(i, j) == V.GetOppCol(color)
      ) {
        // eat!
        squares.push([i, j]);
      }
    }
    return squares;
  }
// follow steps from x,y until something is met.
follow steps from x,y until something is met.
follow steps from x y until something is met .
findCaptures([x, y]) {
    const color = this.getColor(x, y);
    const piece = this.getPiece(x, y);
    let squares = [];
    const steps =
      piece != V.PAWN
        ? [V.QUEEN,V.KING].includes(piece)
          ? V.steps[V.ROOK].concat(V.steps[V.BISHOP])
          : V.steps[piece]
        : color == "w"
          ? [
            [-1, -1],
            [-1, 1]
          ]
          : [
            [1, -1],
            [1, 1]
          ];
    const oneStep = [V.KNIGHT,V.PAWN,V.KING].includes(piece);
    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.getColor(i, j) == V.GetOppCol(color)
      ) {
        squares.push([i, j]);
      }
    }
    return squares;
  }
findCaptures ( [ x , y ] ) { const color = this . getColor ( x , y ) ; const piece = this . getPiece ( x , y ) ; let squares = [ ] ; const steps = piece != V . PAWN ? [ V . QUEEN , V . KING ] . includes ( piece ) ? V . steps [ V . ROOK ] . concat ( V . steps [ V . BISHOP ] ) : V . steps [ piece ] : color == "w" ? [ [ - 1 , - 1 ] , [ - 1 , 1 ] ] : [ [ 1 , - 1 ] , [ 1 , 1 ] ] ; const oneStep = [ V . KNIGHT , V . PAWN , V . KING ] . includes ( piece ) ; 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 . getColor ( i , j ) == V . GetOppCol ( color ) ) { squares . push ( [ i , j ] ) ; } } return squares ; }
follow steps from x,y until something is met.
follow steps from x y until something is met .
// eat!