469,903 Members | 1,806 Online

# Creating a simple Craps game in Java

Can you guys help me out? I'm trying to create a very simple game of craps but having some trouble. Below are the rules and requirements. Much appreciated!

Given the following rules for the game of Craps, simulate the play of a game, using the console to output the results of each roll and a WIN/LOSE message. Example output for a couple of runs is shown.

The player rolls two 6-sided dice (hint: use 1 + (int)(Math.random() * 6) ) to generate a random number between 1 and 6
A roll of 7 or 11 on the first try is a WIN
A roll of 2, 3 or 12 on the first try is a LOSE
Any other roll on the first try becomes the player's POINT
If a player rolled POINT, the player continues to roll until one of two things happens:
If a player in POINT rolls the POINT again, it is a WIN
If a player in POINT rolls 7, it is a LOSE
Example runs:
You rolled 7.
You win!

You rolled 12.
You lose!

You rolled 4. POINT is 4.
You rolled 3. POINT is 4.
You rolled 11. POINT is 4.
You rolled 4.
You win!
Jun 26 '07 #1
2 3374
r035198x
13,262 8TB
Can you guys help me out? I'm trying to create a very simple game of craps but having some trouble. Below are the rules and requirements. Much appreciated!

Given the following rules for the game of Craps, simulate the play of a game, using the console to output the results of each roll and a WIN/LOSE message. Example output for a couple of runs is shown.

The player rolls two 6-sided dice (hint: use 1 + (int)(Math.random() * 6) ) to generate a random number between 1 and 6
A roll of 7 or 11 on the first try is a WIN
A roll of 2, 3 or 12 on the first try is a LOSE
Any other roll on the first try becomes the player's POINT
If a player rolled POINT, the player continues to roll until one of two things happens:
If a player in POINT rolls the POINT again, it is a WIN
If a player in POINT rolls 7, it is a LOSE
Example runs:
You rolled 7.
You win!

You rolled 12.
You lose!

You rolled 4. POINT is 4.
You rolled 3. POINT is 4.
You rolled 11. POINT is 4.
You rolled 4.
You win!
What do you have so far?
First list down the objects/methods that you are going to need.
Jun 26 '07 #2
664 Expert 512MB
Can you guys help me out? I'm trying to create a very simple game of craps but having some trouble. Below are the rules and requirements. Much appreciated!

Given the following rules for the game of Craps, simulate the play of a game, using the console to output the results of each roll and a WIN/LOSE message. Example output for a couple of runs is shown.

The player rolls two 6-sided dice (hint: use 1 + (int)(Math.random() * 6) ) to generate a random number between 1 and 6
A roll of 7 or 11 on the first try is a WIN
A roll of 2, 3 or 12 on the first try is a LOSE
Any other roll on the first try becomes the player's POINT
If a player rolled POINT, the player continues to roll until one of two things happens:
If a player in POINT rolls the POINT again, it is a WIN
If a player in POINT rolls 7, it is a LOSE
Example runs:
You rolled 7.
You win!

You rolled 12.
You lose!

You rolled 4. POINT is 4.
You rolled 3. POINT is 4.
You rolled 11. POINT is 4.
You rolled 4.
You win!
how many object do you need? Dice
write a ramdom method.
what kind of statement do you want to use.
if
for...