Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3 Jupyter Notebook Data Science Problem: In this problem you will write some code to simulate the game of Miniopoly (a very rough approximation
Python 3 Jupyter Notebook Data Science Problem:
In this problem you will write some code to simulate the game of Miniopoly (a very rough approximation of Monopoly). The game consists of a round board with 40 "squares" numbered from 0 to 40, where squares 0 and 40 are coincident and called GO. A player starts on GO with 1$200 in their pocket. On each turn the player rolls a pair of dice and then moves a number of spaces equal to the sum of the dice. Landing on different squares have different results: Squares 2, 7, 17, 22, 33, and 36 cause you to draw a card. The cards tell you to collect 1$50 or 1$100, or pay the bank 1$100, 1$125, or 1$150 Squares 0, 10, and 20 do not trigger any action Square 30 is Go To Jail, which sends the player directly to Jail and ends the turn e If a player starts a turn from Jail she rolls two dice If the player rolls doubles (i.e. the dice have equal values) the player moves from Square 10 a number of squares equal to the sum of the dice - If the player rolls anything other than doubles she pays the bank I$10 and remains in Jail If the player passes or lands on GO she collects I$200. e If the player lands on any other square not mentioned above, she pays the bank an amount equal to the square's number (e.g. if she lands on Square 29 she pays the bank I$29). If the player rolls doubles, she gains 10 the doubled number, in addition to whatever other actions her roll may have caused. For example, rolling two sixes results in a payment of IS60. This rule does not apply if the player begins the turrn from Jail If at any point the player has iS0 or less they go bankrupt and the game ends Part A: Complete the function miniopoly turn below. The function should simulate one turn of Miniopoly. It should take as arguments the player's current location on the board as well as the player's current cash reserves, and return the player's new location and cash reserves after the turn has completed. Note that if a player goes bankrupt during the game you should return their cash as 0 instead of a negative value. In def miniopoly turn (state, cash): return state, cash Part B: Use your function from Part A to Simulate at least 5000 30-turn games of Miniopoly and make a frequency histogram of the player's cash at the end of the game. In : Part C: Use your code from Part A to estimate the probability that a player goes bankrupt in the first 30 turns of the game. In In this problem you will write some code to simulate the game of Miniopoly (a very rough approximation of Monopoly). The game consists of a round board with 40 "squares" numbered from 0 to 40, where squares 0 and 40 are coincident and called GO. A player starts on GO with 1$200 in their pocket. On each turn the player rolls a pair of dice and then moves a number of spaces equal to the sum of the dice. Landing on different squares have different results: Squares 2, 7, 17, 22, 33, and 36 cause you to draw a card. The cards tell you to collect 1$50 or 1$100, or pay the bank 1$100, 1$125, or 1$150 Squares 0, 10, and 20 do not trigger any action Square 30 is Go To Jail, which sends the player directly to Jail and ends the turn e If a player starts a turn from Jail she rolls two dice If the player rolls doubles (i.e. the dice have equal values) the player moves from Square 10 a number of squares equal to the sum of the dice - If the player rolls anything other than doubles she pays the bank I$10 and remains in Jail If the player passes or lands on GO she collects I$200. e If the player lands on any other square not mentioned above, she pays the bank an amount equal to the square's number (e.g. if she lands on Square 29 she pays the bank I$29). If the player rolls doubles, she gains 10 the doubled number, in addition to whatever other actions her roll may have caused. For example, rolling two sixes results in a payment of IS60. This rule does not apply if the player begins the turrn from Jail If at any point the player has iS0 or less they go bankrupt and the game ends Part A: Complete the function miniopoly turn below. The function should simulate one turn of Miniopoly. It should take as arguments the player's current location on the board as well as the player's current cash reserves, and return the player's new location and cash reserves after the turn has completed. Note that if a player goes bankrupt during the game you should return their cash as 0 instead of a negative value. In def miniopoly turn (state, cash): return state, cash Part B: Use your function from Part A to Simulate at least 5000 30-turn games of Miniopoly and make a frequency histogram of the player's cash at the end of the game. In : Part C: Use your code from Part A to estimate the probability that a player goes bankrupt in the first 30 turns of the game. In
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started