Construct and perform a Monte Carlo simulation of blackjack (also called twenty-one). The rules of blackjack are
Question:
Construct and perform a Monte Carlo simulation of blackjack (also called twenty-one). The rules of blackjack are as follows: Most casinos use six or eight decks of cards when playing this game to inhibit ``card counters.'' You will use two decks of cards in your simulation (104 cards total). There are only two players, you and the dealer. Each player receives two cards to begin play. The cards are worth their face value for 2–10, 10 for face cards (jack, queen, and king), and either 1 or 11 points for aces. The object of the game is to obtain a total as close to 21 as possible without going over (called ``busting'') so that your total is more than the dealer's.
If the first two cards total 21 (ace–10 or ace–face card), this is called blackjack and is an automatic winner (unless both you and the dealer have blackjack, in which case it is a tie, or ``push,'' and your bet remains on the table).Winning via blackjack pays you 3 to 2, or 1.5 to 1 (a $1 bet reaps $1.50, and you do not lose the $1 you bet). If neither you nor the dealer has blackjack, you can take as many cards as you want, one at a time, to try to get as close to 21 as possible. If you go over 21, you lose and the game ends. Once you are satisfied with your score, you ``stand.'' The dealer then draws cards according to the following rules:
The dealer stands on 17, 18, 19, 20, or 21. The dealer must draw a card if the total is 16 or less. The dealer always counts aces as 11 unless it causes him or her to bust, in which case the ace is counted as a 1. For example, an ace6 combo for the dealer is 17, not 7 (the dealer has no option), and the dealer must stand on 17. However, if the dealer has an ace4 (for 15) and draws a king, then the new total is 15 because the ace reverts to its value of 1 (so as not to go over 21). The dealer would then draw another card.
If the dealer goes over 21, you win (even your bet money; you gain $1 for every $1 you bet). If the dealer's total exceeds your total, you lose all the money you bet. If the dealer's total equals your total, it is a push (no money exchanges hands; you do not lose your bet, but neither do you gain any money).What makes the game exciting in a casino is that the dealer's original two cards are one up, one down, so you do not know the dealer's total and must play the odds based on the one card showing. You do not need to incorporate this twist into your simulation for this project. Here's what you are required to do:
Run through 12 sets of two decks playing the game. You have an unlimited bankroll (don't you wish!) and bet $2 on each hand. Each time the two decks run out, the hand in play continues with two fresh decks (104 cards). At that point record your standing (plus or minus X dollars). Then start again at 0 for the next set of decks. Thus your output will be the 12 results from playing each of the 12 sets of decks, which you can then average or total to determine your overall performance.
What about your strategy? That's up to you! But here's the catch you will assume that you can see neither of the dealer's cards (so you have no idea what cards the dealer has). Choose a strategy to play, and then play it throughout the entire simulation. (Blackjack enthusiasts can consider implementing doubling down and splitting pairs into their simulation, but this is not necessary.) Provide your instructor with the simulation algorithm, computer code, and output results from each of the 12 decks.
Step by Step Answer:
A First Course In Mathematical Modeling
ISBN: 9781285050904
5th Edition
Authors: Frank R. Giordano, William P. Fox, Steven B. Horton