Project 1 – Baccarat
Due: Monday, June 16, 2014 by 11:59pm
Baccarat is a card game that resembles Blackjack. Two players, referred to as the player and the banker get dealt two cards each. The player that comes closest to having a hand total of 9, wins. Before the hands are dealt, bets may be placed on the banker hand, on the player hand, or on a tie. No matter how many players there are, there is only one hand representing all of them dealt.
All Tens and face cards (jack, queen, and king) are worth zero. The ace is worth "1" and the Two through Nine are worth their face value.
Card suits have no meaning in Baccarat.
The total of the hand, regardless if it consists of two or three cards, is determined by summing up the values of the cards in the hand.
If the total of the hand is 10 or more, 10 must be subtracted. The remaining total is the card count.
The dealer gives two cards each to the player and the banker.
1. If either the player or the banker has a total of an 8 or a 9 they both stand. There are no exceptions and this rule overrides all other rules.
2. If the player has total of 6 or 7, the player stands.
3. If the player stands, the banker hits on a total of 5 or less.
4. If the player has total of 5 or less, the player automatically hits and the banker gives the player a third card.
If the player gets a third card because of rule 4, the following table summarizes the action of the banker:
Banker's |
Player's Third Card |
|||||||||
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
|
7 |
S |
S |
S |
S |
S |
S |
S |
S |
S |
S |
6 |
S |
S |
S |
S |
S |
S |
H |
H |
S |
S |
5 |
S |
S |
S |
S |
H |
H |
H |
H |
S |
S |
4 |
S |
S |
H |
H |
H |
H |
H |
H |
S |
S |
3 |
H |
H |
H |
H |
H |
H |
H |
H |
S |
H |
2 |
H |
H |
H |
H |
H |
H |
H |
H |
H |
H |
1 |
H |
H |
H |
H |
H |
H |
H |
H |
H |
H |
0 |
H |
H |
H |
H |
H |
H |
H |
H |
H |
H |
Write a program in MIPS under MARS that plays the game of Baccarat according to the rules above.
1. Ask the player his or her name
2. Then ask them if they would like to bet on the player winning, the banker winning, or there being a tie.
3. Next, deal 2 cards and calculate the hand total as described above.
4. Then follow the rules above to determine whether to give each player a third card.
5. Tally the two or three cards for each hand, and determine a winner.
6. Finally, display whether the bet placed at the beginning was correct, and ask if the player would like to play again.
You may consider there to be an infinite deck of cards, however the probability of getting a face card must be correct.
Create a zip file of your source code and a README.txt text file that has your name, your Pitt username and any notes for the TA to help with grading.
Name the file USERNAME-project1.zip
Use the lab submission policies to upload your project.