Question
You will write a program that implements the following version of the game of Nim. Nim is a mathematical strategy game, which dates back to
You will write a program that implements the following version of the game of Nim. Nim is a mathematical strategy game, which dates back to 16th century China. There are many variations on this game, but the version well be playing starts with a row of 11 sticks: ||||||||||| On their turn a player may remove 1, 2, or 3 sticks from the pile. Players alternate taking turns, and the play removing the last stick wins. Your game should feature two players alternating turns. First, your program should print out a welcome statement and brief instructions. Then, you should display the current game state and prompt player 1 for the number of sticks they should remove: Welcome to Nim! Players will take turns removing 1, 2, or 3 sticks from the initial 11. The player removing the last stick wins! Player 1, its your turn! The game currently looks like this: ||||||||||| How many sticks would you like to remove? (1, 2, or 3) After making sure they entered a valid response, you should remove the appropriate number of sticks. If there are now zero sticks remaining, you should declare that player the winner and end the program. Otherwise, the other player should take a turn. Here is a sample run of the program C++ Thank you
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