import java.util.ArrayList;

/**
 * An example using HighScore objects.
 *
 * @author Zach Tomaszewski
 */
public class ArcadeGame {

  public static void main(String[] args) {

    //Create a list of random players with names of the form
    //"AAA", "BBB", "CCC", ..., each with a random score b/w 1 and 1000.
    ArrayList<HighScore> scores = new ArrayList<HighScore>();
    for (int i = 0; i < 10; i++) {
      char letter = (char) ('A' + i);
      String name = "" + letter + letter + letter;
      int score = (int) (Math.random() * 1000) + 1;
      scores.add(new HighScore(name, score));
    }

    //print scores (using the enhanced/iterator version of for loop)
    System.out.println("Sample HighScores: ");
    for (HighScore s : scores) {
      System.out.println(s); //calls toString()
    }

    //sort score, which requires them to implement Comparable
    java.util.Collections.sort(scores);

    //print scores again
    System.out.println();
    System.out.println("After sorting: ");
    for (HighScore s : scores) {
      System.out.println(s);
    }
  }
}