public class Main {

//Global Variables

	static Hopper[] hoppers;

	//main function

	public static void main(String[] args){

		
		
		initialiseHoppers();

		//create a target distance

		int targetDistance = generateTargetDistance();

		//race to the target distance
		race(targetDistance);
		
		sortHoppers();
		
		displayPodium();
			
	
	}
	
	


	public static void initialiseHoppers() {

		hoppers = new Hopper[3];
		
		hoppers[0] = new Hopper("Fred");
		
		hoppers[1] = new Hopper("Cheryl");
		
		hoppers[2] = new Hopper("Lin");
	
	}
	
	public static int generateTargetDistance() {
		return (int)(Math.random()*301)+200;
	}

	//while no winner, make each hopper hop, remove hoppers if necessary

	public static void race(int td) {

		
		while(hoppers[0].getDistance()<td && hoppers[1].getDistance()<td && hoppers[2].getDistance()<td) {
			
			for(int i = 0; i < 3; i++) {
				int rand = (int)(Math.random()*20);
				hoppers[i].hop(rand);
			}
			
		}	

	}
	
	public static void sortHoppers() {
		//selection sort
		
	}
	
	public static void displayPodium() {
		//call the toString method of each hopper in order of index from 0 to 2
		
	}
	

}