package edu.bloomu.ch5a;

import java.util.concurrent.ThreadLocalRandom;

/**
 * Simulates the first roll in the game of Craps. The player rolls two dice. A sum of 7 
 * or 11 wins and a sum of 2, 3, or 12 loses; in any other case, the game continues
 * according to a different rule (details omitted).
 * 
 * @author Drue Coles
 */
public class FirstRoll {

    public static void main(String[] args) {
        
        ThreadLocalRandom rand = ThreadLocalRandom.current();
        int die1 = rand.nextInt(1, 7);
        int die2 = rand.nextInt(1, 7);
        int sum = die1 + die2;
        
        System.out.printf("You rolled %d + %d = %d.%n", die1, die2, sum);
        
        // Default output will be modified if the player wins or loses.
        String result = "The game continues.";
        
        if (sum == 7) {
            result = "YOU WIN.";
        }
        if (sum == 11) {
            result = "YOU WIN.";
        }
        if (sum == 2) {
            result = "YOU LOSE.";
        }
        if (sum == 3) {
            result = "YOU LOSE.";
        }
        if (sum == 12) {
            result = "YOU LOSE.";
        }
        System.out.println(result);
    }
}