Question: On each turn a player must remove either 1 or 2 sticks from the pile. The goal of the game is to be the player

On each turn a player must remove either 1 or 2 sticks from the pile. The goal of the game is to be the player who removes the last stick.

You will design a game in which one human player is competing against a computer. To simplify your work the person will always take the first turn.

Example

Round 0: 7 at start human takes 2, so 5 remain

Round 1: 5 at start computer takes 2, so 3 remain

Round 2: 3 at start human takes 2, so 1 remain

Round 3: 1 at start computer takes 1, so 0 remain

The computer wins / you lose!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!