Question: This is a python problem, after importing the problem2 module, I will type one armed bandit() in the Python shell to test problem2.py. Problem 2
This is a python problem, after importing the problem2 module, I will type one armed bandit() in the Python shell to test problem2.py.


Problem 2 [20 points ] One Armed Bandit. In casinos from Monte Carlo to Las Vegas, one of the most common gambling devices is the slot machine - the "one-armed bandit". A typical such machine has three horizontally aligned wheels that spin around behind a narrow window Each wheel is marked with the following symbols: CHERRY, LEMON, ORANGE, PLUM, BELL, and BAR. The window, however, allows you to see only one symbol on each wheel at a time. For example, the window might show the configuration: BELL ORANGE BAR If you put a silver dollar into the slot machine and pull the handle on its side, the wheels spin around and eventually come to a rest in some new configuration. If that configuration matches one among a set of winning patterns printed on the front of the slot machine, you get back some money. If not, you're out a dollar. The following table shows a typical such set of winning patterns along with their associated payoffs: pays $2 pays S5 pays $7 CHERRY CHERRY CHERRY CHERRY ORANGE ORANGE ORANGE/BAR pays $10 PLUM BELL BAR CHERRY CHERRY PLUM BELL BAR PLUM/BAR pays $14 BELL/BAR pays $20 BAR pays $250 The notation BELL/BAR means that either a BELL or a BAR can appear in that position, and a dash means that any symbol at all can appear. Thus, getting a CHERRY in the first position is automatically good for two dollars, no matter what appears on the other wheels. Note that there is never any payoff for the LEMON symbol, even if you happen to line up three of them Write a program that simulates playing the slot machine. You will do this by writing a program with the functions described below. . (10 points) Implement a function called one armed.bandit without any parameters. This function should provide the player with an initial stake of $50 and then let her play repeatedly until the money runs out or the player decides to quit (do this with a while loop). During each round, your program should take away a dollar (since each spin of the wheel costs $1). Then spin the wheel and calculate the resulting payoff, if any (via a Problem 2 [20 points ] One Armed Bandit. In casinos from Monte Carlo to Las Vegas, one of the most common gambling devices is the slot machine - the "one-armed bandit". A typical such machine has three horizontally aligned wheels that spin around behind a narrow window Each wheel is marked with the following symbols: CHERRY, LEMON, ORANGE, PLUM, BELL, and BAR. The window, however, allows you to see only one symbol on each wheel at a time. For example, the window might show the configuration: BELL ORANGE BAR If you put a silver dollar into the slot machine and pull the handle on its side, the wheels spin around and eventually come to a rest in some new configuration. If that configuration matches one among a set of winning patterns printed on the front of the slot machine, you get back some money. If not, you're out a dollar. The following table shows a typical such set of winning patterns along with their associated payoffs: pays $2 pays S5 pays $7 CHERRY CHERRY CHERRY CHERRY ORANGE ORANGE ORANGE/BAR pays $10 PLUM BELL BAR CHERRY CHERRY PLUM BELL BAR PLUM/BAR pays $14 BELL/BAR pays $20 BAR pays $250 The notation BELL/BAR means that either a BELL or a BAR can appear in that position, and a dash means that any symbol at all can appear. Thus, getting a CHERRY in the first position is automatically good for two dollars, no matter what appears on the other wheels. Note that there is never any payoff for the LEMON symbol, even if you happen to line up three of them Write a program that simulates playing the slot machine. You will do this by writing a program with the functions described below. . (10 points) Implement a function called one armed.bandit without any parameters. This function should provide the player with an initial stake of $50 and then let her play repeatedly until the money runs out or the player decides to quit (do this with a while loop). During each round, your program should take away a dollar (since each spin of the wheel costs $1). Then spin the wheel and calculate the resulting payoff, if any (via a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
