Question: I need help creating these three functions: The simulate function should simulate playing a given number of hands of blackjack and track the winnings (
I need help creating these three functions:
The simulate function should simulate playing a given number of hands of blackjack and track the winnings and high and lowwater marksThe simulate method should handle player actions, including betting, hitting, staying, doubling, and payoff. Let's ignore insurance and splitting to make things easier. It should reshuffle on the next hand after the penetration percentage has been achieved in the shoe and notify the player
Code Snippet:
def simulateplayer
dealerSoft
hands
ndecks
penetration
nplayers:
simulate playing an evening's worth of blackjack
:param player: Blackjack object representing the player
:param dealer: Blackjack object representing the dealer
:param hands: Number of hands to simulate
:param ndecks: Number of decks in each shoe
:param penetration: Depth of shoe before reshuffling
:param nplayers: Number of other players present not simulated, but cards seen
:return: final lo hi player's accumulated winnings
The visualize function must call simulate and then plot the results in a histogram with the other visualization features noted above on the plot.
Code Snippet:
def visualizetrials playerBasic:
simulate and plot results of a blackjack strategy
:param trials: number of trials to simulate
:param player: player Blackjack object to simulate
The helper function, overlaybellcurve, must also be called by visualize and have the following spec for itself and also its nested function f
Code Snippet:
def overlaybellcurvemu sigma, n bins:
Overlay a normal curve atop an histogram on current pylab figure.
:param mu: mean
:param sigma: standard deviation
:param n: number of events tracked in histogram
:param bins: number of bins in histogram
def fx:
probability density function of normal distribution"""
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
