469,903 Members | 1,806 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

Creating a simple Craps game in Java

1
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
nomad
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...

nomad
Jun 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by tmb | last post: by
6 posts views Thread by tigrfire | last post: by
9 posts views Thread by Niels Jensen | last post: by
1 post views Thread by nemesis | last post: by
3 posts views Thread by whitehatmiracle | last post: by
8 posts views Thread by AeonOfTime | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.