private float maxScore(float[] mlePlatter) {
    float fruitsTaken = 0;
    float maxScore = 0;
    float currentPref = prefs.length;
    while (fruitsTaken < numFruits && currentPref > 0) {
      int currentFruit = indexOf(prefs, currentPref);
      if (numFruits - fruitsTaken < mlePlatter[currentFruit]) {
        maxScore += (numFruits - fruitsTaken) * currentPref;
        fruitsTaken = numFruits;
      } else {
        maxScore += mlePlatter[currentFruit] * currentPref;
        fruitsTaken += mlePlatter[currentFruit];
      }
      currentPref--;
    }
    return maxScore;
  }