import java.util.Random; // add the ArrayList and Collections libraries: import java.util.ArrayList; import java.util.Collections; public class GameUndone { public static void main (String[] args) { Random r = new Random(); // create two players ArrayList p = new ArrayList(); p.add(new Player("Sally")); p.add( new Player("John")); // play 5 rounds of a game that // has one die per turn for (int c = 0; c < 5; c++){ // instead of repeating these 3 lines // make a loop using a for each loop for (Player guy : p){ int roll = r.nextInt(4) +1; guy.move(roll); System.out.println(guy); } } // after the game, print both once more // - print the players in sorted order Collections.sort(p); for (Player guy : p){ System.out.println(guy); } } }