import java.util.Scanner;

/**
 * This class provides a command line interface for
 * demonstrating the function of the Yahtzee class.
 *
 * @author Ralph Grove
 * @author Chris Mayfield
 * @version 02/08/2017
 */
public class Driver {
    
    /**
     * Simulates one turn of a Yahtzee game:
     * 1. generate random values to instantiate a Dice object
     * 2. display the dice and ask the user how to score them
     * 3. invoke Yahtzee.calculateScore() to score the dice
     * 4. display the dice score based on the user's choice
     *
     * @param args command-line arguments
     */
    public static void main(String[] args) {
        int die1;
        int die2;
        int die3;
        int die4;
        int die5;
        Dice dice;
        int choice;
        
        Scanner in = new Scanner(System.in);
        
        die1 = (int) (Math.random() * 6) + 1;
        die2 = (int) (Math.random() * 6) + 1;
        die3 = (int) (Math.random() * 6) + 1;
        die4 = (int) (Math.random() * 6) + 1;
        die5 = (int) (Math.random() * 6) + 1;
        dice = new Dice(die1, die2, die3, die4, die5);
        
        System.out.println("You rolled: " + die1 + ", " + die2 + ", "
                               + die3 + ", " + die4 + ", " + die5);
        System.out.println("How would you like to play them?");
        System.out.println("Ones: " + Yahtzee.ONES);
        System.out.println("Twos: " + Yahtzee.TWOS);
        System.out.println("Threes: " + Yahtzee.THREES);
        System.out.println("Fours: " + Yahtzee.FOURS);
        System.out.println("Fives: " + Yahtzee.FIVES);
        System.out.println("Sixes: " + Yahtzee.SIXES);
        System.out.println("Three of a kind: " + Yahtzee.THREE_OF_A_KIND);
        System.out.println("Four of a kind: " + Yahtzee.FOUR_OF_A_KIND);
        System.out.println("Full House: " + Yahtzee.FULL_HOUSE);
        System.out.println("Small Straight: " + Yahtzee.SMALL_STRAIGHT);
        System.out.println("Large Straight: " + Yahtzee.LARGE_STRAIGHT);
        System.out.println("Yahtzee: " + Yahtzee.YAHTZEE);
        System.out.println("Chance: " + Yahtzee.CHANCE);
        
        choice = in.nextInt();
        System.out.println("The value of your roll is: "
                               + Yahtzee.calculateScore(choice, dice));
    }
    
}
