Question: I need help with this assignment In this lab you will design and implement a C program that models a version of the game Nim.
I need help with this assignment
In this lab you will design and implement a C program that models a version of the game Nim. The game of Nim is played as follows:
A pile of N toothpicks (or other item) is created.
Two players take turns removing toothpicks. On a turn, a player can remove 1, 2, or 3 toothpicks .
Players alternate picking up until all toothpicks are gone.
The player who removes the last toothpick is the loser.
Instructions
Your program should
have a computer player and human player.
randomly select the player to go first
have the second player choose the number of toothpicks - which must be bigger than 20 and smaller than 30 (if this is the computer, then use a random generator to determine the value of n)
prompt for a number 1, 2, or 3 on the human turn.
generate a random valid choice on the computer turn.
print the remaining number of toothpicks on the screen after every move - human or computer
print YOU WIN or YOU LOSE after the last toothpick is removed.
allow the user to play as many games as they want
Your code must meet the following technical specifications
use at least two variables of different types
no global variables allowed
use at least one selection structure
use at least one looping structure
use at least two functions with prototype.
Your overall program logic, design, and formatting should be clear, well organized, and strucutred
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
