Your first task will be to write a simple movement simulator on a snakes and ladders board. For this question you can ignore the snakes and ladders and just simply assume you only have to deal with moving. You will need to simulate rolling the die - this can be done by using the Python random module and the randint method. Your function play_game will take as input the length of the board (an integer), "play" the game by rolling the die multiple times until the sum of rolls is larger or equal to the length of the board. (note: this is one of the possible and simplest end rules). The function should return the total number of rolls required to finish the the particular game that was played. Obviously this number will vary as it depends on the specific random rolls performed during the movement simulation.
Your first task will be to write a simple movement simulator on a snakes and ladders board. For this question
you can ignore the snakes and ladders and just simply assume you only have to deal with moving. You will
need to simulate rolling the die - this can be done by using the Python random module and the randint method.
Your function play_game will take as input the length of the board (an integer), "play" the game by rolling the die
multiple times until the sum of rolls is larger or equal to the length of the board. (note: this is one of the possible
and simplest end rules). The function should return the total number of rolls required to finish the the particular
game that was played. Obviously this number will vary as it depends on the specific random rolls performed
during the movement simulation.


Step by step
Solved in 2 steps









