Question: Please code using the C language (NOT C++) and include comments so that I can understand/learn. Thank you in advance! You will write a program
Please code using the C language (NOT C++) and include comments so that I can understand/learn. Thank you in advance!

You will write a program that plays the game Nim. Note that there are many variations of this game, the version we use here is one of the simplest forms. The game is played with one pile of marbles, starting with between 10 and 100 marbles. Two players take turns removing marbles from the pile, and whichever player takes the last marble loses. Each player must take at least one marble and at most half of the marbles. Note: on the last turn, there will be one marble in the pile: the loser has to take this marble, even though this is more than half of the marbles! Your program should do the following: 1. Pick a number between 10 and 100. This value should be placed in the variable count. 2. Inform the player of the number of marbles, count. 3. Determine the largest value the user can take, which is half of count (or 1 at the end of the game. 4. Prompt the user to enter a value between 1 and the limit determined in step 3. 5. Check the user's input to make sure the value is in range. If not, complain to the user and get a new value. 6. Subtract the value from count. 7. Determine the number of marbles to be taken by the program. Print this value for the user, then subtract this number from count. 8. Go back to step 2, unless either the program or the user wins
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
