Here is a concise Java program for the Three Dice Game:
The Code
import java.util.Random;
public class ThreeDiceGame {
public static void main(String[] args) {
int totalPoints = 0;
int blasts = 0;
Random random = new Random();
for (int i = 0; i < 10; i++) {
// Display the face values of three dice
int dice1 = random.nextInt(6) + 1;
int dice2 = random.nextInt(6) + 1;
int dice3 = random.nextInt(6) + 1;
System.out.println("Roll " + (i + 1) + ": Dice 1: " + dice1 + ", Dice 2: " + dice2 + ", Dice 3: " + dice3);
// Decide how to calculate the total points
int sum = dice1 + dice2 + dice3;
// Decide if it's blasted or not
if (dice1 == dice2 && dice2 == dice3) {
blasts++;
System.out.println("Blast! No points earned.");
} else {
totalPoints += sum;
System.out.println("Points earned: " + sum);
}
}
// Display game output
System.out.println("\\Game Output:");
System.out.println("Number of blasts: " + blasts);
System.out.println("Total points earned: " + totalPoints);
}
}