You are on page 1of 5

Class Assignment 3

Algorithm

Variables

myRoll
Type –Game type
int Dead –second flag
char Play – ask to play again
int Flag –first flag
int Point- point set

Functions

void CrapsIntro() - brief description of Craps game


int CrapsRoll() - outcome of two six-sided dice rolls
void myTimeDelay(int) -time delay between rolls
void PassLine() – pass line function
void DontPassLine() – Don’t pass line function

Display Welcome screen

Display rules

Ask which type they wish to play

If

Pass Line.

 The Pass Line bet


o If the come-out roll is a 7 or 11, the player wins.
o If the come-out roll is 2, 3 or 12, the player loses ("crapping out").
o If the come-out roll is any other value (4, 5, 6, 8, 9, or 10), it establishes a
point.
o The player continues to roll, until
 If the established point is rolled again before a seven, the player wins.
 If, with an established point, a 7 is rolled before the established point
is re-rolled the player loses ("seven out").
Else if
 The Don't Pass Line bet
o If the come-out roll is 7 or 11, the player looses.
o If the come-out roll is 2 or 3, the player wins.
o If the come-out roll is 12, the game is a draw and the player does not lose.
o If the come-out roll is any other value (4, 5, 6, 8, 9, or 10), it establishes a
point.
o The player continues to roll, until
 If the established point is rolled again before a seven, the player loses.
 If, with an established point, a 7 is rolled before the established point
is re-rolled the player wins.

Ask the player if they want to play again


If not exit
Else if yes go back to game selection

Test Cases

Case# Description Input Expected Actual Pass/Fail Remarks


output Output
1 Outcome N/A Win Win Pass Call Passline()
roll 7
2 Outcome N/A Lose Lose Pass Call Passline()
roll 2
3 Outcome N/A Lose Lose Pass Call Passline()
roll 12
4 Point then N/A Lose Lose Pass Call Passline()
7
5 Outcome N/A Lose Lose Pass Call Passline()
roll 3
6 Point N/A Win Win Pass Call Passline()
7 Outcome N/A Lose Lose Pass Call
roll 7 DontPassline()
8 Outcome N/A Win Win Pass Call
roll 2 DontPassline()
9 Outcome N/A Draw Draw Pass Call
roll 12 DontPassline()
10 Point then N/A Win Win Pass Call
7 DontPassline()
11 Outcome N/A Win Win Pass Call
roll 3 DontPassline()
12 Point N/A Lose Lose Pass Call
DontPassline()
13 Outcome N/A Lose Lose Pass Call
11 DontPassline()
Output from 5 Runs

1.

2.
3.

4.
5.

You might also like