Kingdom of Trolls is celebrating their Kingdom Day and one of the activities that is taking place is a game where a player rolls a magic ball down the hill on a path with spikes. As the ball rolls down, it strikes a spike and bursts open to release a number of smaller balls (in our simulated game, the number of smaller balls is a randomly generated integer between 2 and 6, inclusive). As the smaller balls further roll down, when one strikes a spike, that ball and all its sibling balls burst and each generates another set of smaller balls (using the same random number already generated for the first roll). The balls keep rolling downhill and striking spikes and bursting into smaller balls until a golden ball is released by one of the bursts. At this time, the game is over and the player is told how many balls were generated during the last burst (including the golden ball). The game is played by two players at a time and the player who had the lowest number of balls generated on the last burst, in order to find the golden ball, wins the game. Write a Python program to simulate this ball game by using the following functions:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Kingdom of Trolls is celebrating their Kingdom Day and one of the activities that is taking place is a game
where a player rolls a magic ball down the hill on a path with spikes. As the ball rolls down, it strikes a spike
and bursts open to release a number of smaller balls (in our simulated game, the number of smaller balls is a
randomly generated integer between 2 and 6, inclusive). As the smaller balls further roll down, when one
strikes a spike, that ball and all its sibling balls burst and each generates another set of smaller balls (using the
same random number already generated for the first roll). The balls keep rolling downhill and striking spikes
and bursting into smaller balls until a golden ball is released by one of the bursts. At this time, the game is
over and the player is told how many balls were generated during the last burst (including the golden ball).
The game is played by two players at a time and the player who had the lowest number of balls generated on
the last burst, in order to find the golden ball, wins the game.
Write a Python program to simulate this ball game by using the following functions:
a recursive function which, given the number of balls to be generated when a single ball bursts, calculates
the number of balls generated on the last burst when a golden ball is released (some printing is done along
the way; see sample output below); note: the presence of a golden ball after a burst is represented by
randomly generated number between 1 and 10; a number greater than 7 is taken as the presence of a golden
ball
• a main function to generate a random number that represents the number of new balls created when a
single ball bursts (this will be the same number for both players), ask the user for two player names and call
the recursive function for each player, and then report the winner (i.e., the player with the lowest number
of balls generated on the last burst) or if the game was a draw. See sample input/output below.
Sample input/output:
Enter the first player's name: Bob
Burst! 4 balls created per ball.
Burst! 4 balls created per ball. Golden ball located.
Enter the second player's name:
Sue
Burst! 4 balls created per ball.
Burst! 4 balls created per ball.
Burst! 4 balls created per ball.
Burst! 4 balls created per ball.
Burst! 4 balls created per ball.
Burst! 4 balls created per ball. Golden ball located.
Balls generated on last burst for Bob is: 16
Balls generated on last burst for Sue is: 4096
Winner: Bob
Transcribed Image Text:Kingdom of Trolls is celebrating their Kingdom Day and one of the activities that is taking place is a game where a player rolls a magic ball down the hill on a path with spikes. As the ball rolls down, it strikes a spike and bursts open to release a number of smaller balls (in our simulated game, the number of smaller balls is a randomly generated integer between 2 and 6, inclusive). As the smaller balls further roll down, when one strikes a spike, that ball and all its sibling balls burst and each generates another set of smaller balls (using the same random number already generated for the first roll). The balls keep rolling downhill and striking spikes and bursting into smaller balls until a golden ball is released by one of the bursts. At this time, the game is over and the player is told how many balls were generated during the last burst (including the golden ball). The game is played by two players at a time and the player who had the lowest number of balls generated on the last burst, in order to find the golden ball, wins the game. Write a Python program to simulate this ball game by using the following functions: a recursive function which, given the number of balls to be generated when a single ball bursts, calculates the number of balls generated on the last burst when a golden ball is released (some printing is done along the way; see sample output below); note: the presence of a golden ball after a burst is represented by randomly generated number between 1 and 10; a number greater than 7 is taken as the presence of a golden ball • a main function to generate a random number that represents the number of new balls created when a single ball bursts (this will be the same number for both players), ask the user for two player names and call the recursive function for each player, and then report the winner (i.e., the player with the lowest number of balls generated on the last burst) or if the game was a draw. See sample input/output below. Sample input/output: Enter the first player's name: Bob Burst! 4 balls created per ball. Burst! 4 balls created per ball. Golden ball located. Enter the second player's name: Sue Burst! 4 balls created per ball. Burst! 4 balls created per ball. Burst! 4 balls created per ball. Burst! 4 balls created per ball. Burst! 4 balls created per ball. Burst! 4 balls created per ball. Golden ball located. Balls generated on last burst for Bob is: 16 Balls generated on last burst for Sue is: 4096 Winner: Bob
Expert Solution
steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY