package engine;

import java.util.ArrayList;
import java.util.Random;

public class Heroine {
  private ArrayList<Integer> coefficients;

  public Heroine() {
    Random random = new Random();
    for (int i = 0; i < 3; i++) {
      coefficients.set(i, random.nextInt(5));
    }
  }

  public int getEvaluation(InternalPlayer player) {
    int evaluation = 0;
    for (int i = 0; i < coefficients.size(); i++) {
      evaluation += player.getParameter(i);
    }
    return evaluation;
  }

  public int getCoefficient(int index) {
    return coefficients.get(index);
  }

  public int getMostFavoritePlayer(ArrayList<InternalPlayer> players) {
    int bestPlayer = 0;
    int bestEvaluation = 0;
    for (int i = 0; i < players.size(); i++) {
      int evaluation = getEvaluation(players.get(i));
      if (bestEvaluation < getEvaluation(players.get(i))) {
        bestPlayer = i;
        bestEvaluation = evaluation;
      }
    }
    return bestPlayer;
  }
}

@@ -157,24 +157,70 @@
 eroine() %7B%0D%0A
+    coefficients = new ArrayList%3CInteger%3E();%0D%0A
     Random r
@@ -300,15 +300,12 @@
 nts.
-set(i, 
+add(
 rand
@@ -319,10 +319,15 @@
 Int(
+16) - 
 5
-)
 );%0D%0A

Fix error