Question
Create the following script in Python: The Game of Stones In this game, two players sit in front of a pile of n stones. For
Create the following script in Python:
The Game of Stones
In this game, two players sit in front of a pile of n stones. For this assignment, let us choose 100 stones but this could be randomly generated. Players take turns removing between 1 and 5 stones, this assuming there are at least 5 stones left in the pile. The person who is able to remove the last of stones or single stone wins.
Your assignment is to write a function to play this game. You may need to use nested while loops, which is one while loop inside another. In the outermost loop, we want to keep playing until we are out of stones. Inside that loop, we want to keep alternating players. Keep the following mind:
i. Is the user's input valid (meaning is it a number?)?
ii. Is the user input a valid number (1-5)?
iii. Are there enough stones in the pile to take off the user's input amount?
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