After I type in a number, the program outputs the computer and then does nothing else. I am not totally sure what is the problem. I am assuming somewhere in the Nim program of the code
Code:
Your bool turn, starts with false, and never in that loop do you change it, so it will be false forever and the player will always play. You need to alter it between true and false inside that loop so the computer gets a turn.
I need to set Pile=Computer(Pile). That will change the number of the Pile. However, when it gets down to 3 I can no longer take anything from the pile. Is that when I should end the code and say that player wins?
First of all, in the beginning, you should clarify to the player how many piles he can take, say between 1-5, so they don't start typing 10 or 20 only to try and find out what's an actual valid take.
Your problem is mainly here - if (userInput > 1 && userInput < (pileSize / 2))
say pileSize is equal to 3. And we want to take 2 from the piles so we can win, heck even 1 who cares, point is, read the condition.
userInput has to be bigger than 1 and at the same time less than pileSize/2. We said pileSize was 3. 3/2 is 1.5.
Numbers bigger 1 are as follows: 2,3,4,5 etc. 1.5 is not an option.
Edit: You're over complicating this little game. You might want to rethink the logic.