Computer Science Canada

Help with Craps Games

Author:  masternav [ Tue Apr 26, 2005 8:44 am ]
Post subject:  Help with Craps Games

I dont get how to follow how many games the user wants

LOOPING STRUCTURES

Problem

Write a program to simulate the game of Craps. In this game a player rolls two six-sided dice. The player wins or loses the game based on these rules:

First Roll

1. If the outcome is a 7 or 11 on the first toss the player wins outright.

2. If the outcome is a 2, or 12 on the first toss the player loses outright.

3. If the outcome is a 3, 4, 5, 6, 8, 9, or 10, the player gets to roll the dice again.

Second and Subsequent Rolls

1. The player keeps rolling the dice until the outcome matches the outcome of the first roll. If a 7 is rolled the game ends and the player loses.

Input

The program should ask the player how many games he/she wants to play.

Output

The output display should be similar to this.


Sample Input and Output

Enter the number of games to be played.
3
GAME 1
Roll 1: 11
YOU WIN!

GAME 2
Roll 1: 5
Roll 2: 8
Roll 3: 5
YOU WIN!

GAME 3
Roll 1: 9
Roll 2: 3
Roll 3: 4
Roll 4: 6
Roll 5: 7
YOU LOSE!

= = = = = = = = = = = = = = = =

SUMMARY OF GAMES

GAMES WON 2
GAMES LOST 1

WIN AVERAGE 66%
= = = = = = = = = = = = = = = =

Author:  jamonathin [ Tue Apr 26, 2005 1:49 pm ]
Post subject: 

You mean how many times the user plays? After he's finished him game, have him choose if he wishes to play another game, and if he does, play again, and have a counter keep track of how many games the user's played, and how many wins/losses.

Author:  masternav [ Tue Apr 26, 2005 2:45 pm ]
Post subject: 

yes can someone help me with that

Author:  jamonathin [ Tue Apr 26, 2005 5:12 pm ]
Post subject: 

It's called, do your work, try it for yourself, and ask for pointers.

Author:  Vertico [ Tue Apr 26, 2005 5:20 pm ]
Post subject: 

just use a var to keep track off how many games have been played. when it reachs whatever the amount of games the user said(= the var used to get how many games), have it exit the loop and display the final result.


: