import java.util.Scanner;

/**
 * Driver class that performs repeated PigGame simulations.
 *   @author Dave Reed
 *   @version 9/13/17
 */
public class PigStats {    
    public final static int NUM_GAMES = 1000000;    

    public static void main(String[] args) {            
        System.out.print("Enter the Pig cutoff: ");       
        Scanner input = new Scanner(System.in);     
        int cutoff = input.nextInt();
              
        PigGame game = new PigGame(cutoff); 
               
        int totalRounds = 0;
        for (int i = 0; i < PigStats.NUM_GAMES; i++) {            
            totalRounds += game.playGame();
        }        
        double avgLength = 
                 (double)totalRounds/PigStats.NUM_GAMES;                

        System.out.println("Average length of " + 
                           PigStats.NUM_GAMES +                            
                           " games with a cutoff of " + 
                           cutoff + ": " + avgLength); 
    }
}

