Type: Long Assignment
Code: C.L.P0014
LAB101 Assignment LOC:
Slot(s):
150
3
Title
Casino player.
Background Context
To give students practice in writing functions and calling those functions to perform more complex tasks.
Program Specifications
You will write a program that simulates a casino for a single player. The user will initially start with $1000. The
user will then be able to choose from the following options:
1) Buy chips
2) Sell chips
3) Play Craps
4) Play Arup's Game of Dice
5) Status Report
6) Quit
Your program will execute each choice until the quits. At this point all of their chips automatically get sold back
to the casino and a message prints out how much money the user has left (of the $1000) after gambling.
Function details:
o One of the most "fair" games to play at a casino is Craps. Here is one version of how to play:
1) Roll a pair of fair six-sided dice.
2) If you roll a 7 or 11, you win!
3) If you roll a 2, 3, or 12, you lose.
4) Otherwise, record what you've rolled. Let this sum be k; also known as your point.
5) If you rolled a point, continue rolling the pair of dice until you get either your point (k) or a sum of seven
on the two dice.
6) If k comes up first, you win!
7) If 7 comes up first, you lose.
o Amazingly, this game is even more "fair" than Craps, but the house still has a 50.2% chance of winning, which is
why the casino hasn't gone broke yet! Here are the rules:
1) Roll a pair of dice.
2) If you roll a sum of 11 or 12, you win.
3) If you roll a sum of 2, you lose.
4) Otherwise, record what you've rolled. Let this sum be k; also known as your point.
5) Roll one more time. If this roll exceeds your point(k), you win!
6) If this roll is the same as your point(k) or lower, you lose.
o Chips cost $11. Whenever a customer buys chips, he/she must give the banker some money. The banker will
always give the user the maximum number of chips they can buy with the money given to them and return the
leftover cash. You will write a single function that takes care of this transaction.
o The casino buys chips back at $10 a piece. You will write a single function that takes care of this transaction.
Expectation of User interface: