Question: I am so confused on how to do this program. please help me write this is Ruby Nim is a strategy game between two players.

 I am so confused on how to do this program. please

help me write this is Ruby Nim is a strategy game between

I am so confused on how to do this program. please help me write this is Ruby

Nim is a strategy game between two players. The game starts with three piles of blocks (or coins or toothpicks or whatever). The first pile has 3 items, the second has 4, and the third has 5. The players get to see how many items are in each pile, and the first player starts. Player #1 picks a pile and removes one or more counters from that pile (it's okay to take the whole pile). Then, Player #2 picks a pile, removing one or more counters from that pile. Player #1 plays again, able to choose any pile. The game continues until one of the players is forced to take the last object. That player is the loser. Write a program that allows two human players to play Nim against each other. The program should detect when the last counter has been taken and declare a winner. The example in the figure below illustrates how a game could progress. Player i, enter your name: Alice Player 2, enter your name: Bob A: 3 B: 4 C: 5 Alice, choose a pilet A How many to remove from pile At 2 A: 1 B: 4 C: 5 Bob, choose a pile: c How many to remove from pile c: 3 A: 1 B: C: 2 Alice, choose a pile: B How many to remove from pile B: 1 A: 1 B: 3 C: 2 Bob, choose a pile: B How many to remove from pile B: 1 A: 1 B: 2 C: 2 Alice, choose a piles A How many to remove from pile A: 1 A: O B: 2 C: 2 Bob, choose a pile: B How many to remove from pile B: 1 A: O B: 1 C: 2 Alice, choose a pile: C How many to remove from pile C: 2 A: O B: 1 C: 0 Bob, choose a pilet B How many to remove from pile B: 1 A: O B: O C: 0 Alice, there are no counters left, so you NINI

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 Databases Questions!