Assignment 1: Vegas Baby! (40 marks)
Due: Friday, September 29, 2017 (4:00pm)Learning Objectives
The purpose of this assignment is to learn about random numbers, probability, and Monte Carlo simulation. Along the way, you will also have a bit of fun by designing one of your own new Vegas card games.
Background
The number of tourists visiting Donald Trump's casino in Las Vegas has been waning of late (much like his political popularity). The Donald has enlisted you to help evaluate some new candidate card games that might help boost tourist traffic to his Vegas gaming tables. Since most of his tourists are Americans, he is considering some very simple card games, with few cards, simple rules, and well-defined payouts. Each is a one-player card game that costs $1 to play each time. Your task is to determine which of these card games are the most attractive (i.e., best probability of winning) or the least attractive (i.e., lowest probability of winning) for players, so that The Donald knows which new card game(s) to deploy.
Here are the new card games that are being considered:
- Boss: The player draws one card. If the card is an ace, then the player wins $10. Otherwise, the player loses.
- Twins: The player draws two cards. If the two cards are exactly identical (i.e., suit, colour, and rank), then the player wins $50. Otherwise, the player loses.
- Biggie: The player draws two cards. If the second card drawn has strictly higher rank than the first card drawn, then the player wins $2. Otherwise, the player loses.
- Sweethearts: The player draws three cards. If at least one card is Hearts, then the player wins $k, where k is the number of drawn cards that are Hearts. Otherwise, the player loses.
- Runny: The player draws five cards. If there is a subset of these cards that makes a run of three or more consecutive card values (e.g., 5-6-7 or 10-J-Q), then the player wins $5. Otherwise, the player loses.
- Your Game Here: Please make up your own proposed Vegas card game here. It should involve at least 2 cards, but at most 10 cards, and have simple rules and payouts.
Technical Requirements
In this assignment, you will implement a Monte Carlo simulation (in either C, C++, or Java) to evaluate and compare six different Vegas card games. For each game, you will simulate 1,000,000 plays of the game in order to estimate the probability of winning.
You will also need to design and implement the code to model a card dealer who is working with a well-shuffled single deck of cards. Attached is some example code for an infinite-deck card dealer, for which the probability of receiving any given card (e.g., the 5 of Diamonds) is always constant, regardless of which (or how many) cards have been drawn previously. Feel free to use this infinite-deck model to get started, but you will need a much more realistic dealer model in order to complete your Monte Carlo experiments.
When you are finished, please submit your solution in electronic form to your TA. Your submission should include the source code for your simulation program, a brief user manual describing how to compile and use your simulator, and a description of the results generated using your program. Please remember that assignments are to be done individually, and submitted to your TA on or before the stated deadline. The penalty for late submissions is 4 marks per day (or portion thereof) beyond the deadline.
Grading Rubric
The grading scheme for the assignment is as follows:
- 10 marks for the design and implementation of a proper Monte Carlo simulator (i.e., main iterative loop, random number generation, statistical output, etc)
- 6 marks for a suitable implementation of a single-deck card dealer (i.e., functionality, correctness, efficiency)
- 12 marks for correct implementation of the Vegas card games indicated above (2 marks each, total of 12)
- 8 marks for your table of simulation results estimating the likelihood of winning each game in both infinite-deck and single-deck scenarios. Augment this table with the expected winnings (in dollars) per play, for each dealer model. Provide a few sentences summarizing your results and observations.
- 4 marks for a clear and concise user manual (at most 1 page) that describes how to compile, configure, and use your simulation program. Make sure to clarify where and how the testing was done (e.g., home, university, office), what works, and what does not. Be honest!
Up to 4 bonus marks will be awarded for a concise mathematical analysis of the probability of winning each of the aforementioned Vegas card games, as validation for your simulation results.
Tips
- This assignment is not overly challenging, but it is a bit tedious, so please get started early. You will likely need at least a week to get it fully working.
- If you are having a hard time figuring out how to get started, then take a look at Algorithm 2.4.1 in the textbook for craps. Or this craps.c example.