This Java application simulates a simplified version of the Craps dice game. Players roll two dice and win or lose based on the outcome of the dice rolls according to specific rules.
- Rolling a sum of 7 results in an immediate loss.
- To win, the player must roll:
- Doubles of 6-6
- Doubles of 5-5
- Doubles of 3-3
- The player loses if they roll:
- Doubles of 4-4
- Doubles of 2-2
- Doubles of 1-1
- If both the computer and the player roll the same sum or both roll a sum of 7, it is a tie.
- Run the program.
- The computer rolls two dice.
- The player rolls two dice.
- The outcome is displayed, indicating whether the player or the computer wins, or if it’s a tie.
- Java: Programming language used for the application.
- Random: Used for generating random dice rolls.
- Copy the code into
Main.java
. - Compile the program with:
javac Main.java
- Run the program with:
java Main
Enjoy playing the Craps game!