Question
(Python 3) Everyone knows the game Snakes and Ladders. Each player has a token and takes turns rolling a die and moving their token by
(Python 3)
Everyone knows the game Snakes and Ladders. Each player has a token and takes turns rolling a die and moving their token by the corresponding number of squares. If a player lands on a ladder, they immediately move up the ladder to a higher-numbered square. If they move to a chute, or snake, they drop down to a lower-numbered square. Someone wins once they get to the last square.
The board for a modified Snakes and Ladder game is shown in Figure 1. The game is played with a fair tetrahedron (4-sided) die.
Figure 1: Modified Snakes and Ladder game board
IMPORTANT NOTE: The finishing square must be reached by an exact roll. Otherwise you stay on the same square for that turn. (e.g if you are on square 6 and roll a 4 then stay on square 6, if you are on square 7 and roll a 3 or 4 then stay on square 7)
In this Python exercise, you will be estimating the average number of plays/moves until the game is finished and the probability that a person starting at square 6 will find themselves on square 3 before finishing the game.
Be sure to include the following in your code:
(a) Simulate playing 10,000 games. Compute the average number of moves until the game is finished. Use the print function to print your answer.
(b) Simulate playing 10,000 games, but this time, start each game from square 6. Compute the probability that a person starting at square 6 will find themselves on square 3 before finishing the game. Use the print function to print your answer.
7 9 6 2 7 9 6 2Step 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