addPawnMoves([x1, y1], [x2, y2], moves, promotions) {
    let finalPieces = [V.PAWN];
    const color = this.getColor(x1, y1);
    const lastRank = (color == "w" ? 0 : V.size.x - 1);
    if (x2 == lastRank) finalPieces = V.PawnSpecs.promotions;
    let tr = null;
    for (let piece of finalPieces) {
      tr = (piece != V.PAWN ? { c: color, p: piece } : null);
      moves.push(this.getBasicMove([x1, y1], [x2, y2], tr));
    }
  }
// instead of this.turn at the beginning of 2 next methods
instead of this.turn at the beginning of 2 next methods
instead of this . turn at the beginning of 2 next methods
addPawnMoves([x1, y1], [x2, y2], moves, promotions) {
    let finalPieces = [V.PAWN];
    const color = this.getColor(x1, y1);
    const lastRank = (color == "w" ? 0 : V.size.x - 1);
    if (x2 == lastRank) finalPieces = V.PawnSpecs.promotions;
    let tr = null;
    for (let piece of finalPieces) {
      tr = (piece != V.PAWN ? { c: color, p: piece } : null);
      moves.push(this.getBasicMove([x1, y1], [x2, y2], tr));
    }
  }
addPawnMoves ( [ x1 , y1 ] , [ x2 , y2 ] , moves , promotions ) { let finalPieces = [ V . PAWN ] ; const color = this . getColor ( x1 , y1 ) ; const lastRank = ( color == "w" ? 0 : V . size . x - 1 ) ; if ( x2 == lastRank ) finalPieces = V . PawnSpecs . promotions ; let tr = null ; for ( let piece of finalPieces ) { tr = ( piece != V . PAWN ? { c : color , p : piece } : null ) ; moves . push ( this . getBasicMove ( [ x1 , y1 ] , [ x2 , y2 ] , tr ) ) ; } }
instead of this.turn at the beginning of 2 next methods
instead of this . turn at the beginning of 2 next methods