Question: Using a 2d array in java, model a game of nim between two different players where each player alternates taking as many stones as they
Using a 2d array in java, model a game of nim between two different players where each player alternates taking as many stones as they want from a pile. There are 3 piles one with 3 stones, 5 stones, and 8 stones. Play continues until someone is forced to take the last stone. The person taking the last stone loses. Write a program that permits two people to play the game of Nim using an array to keep track of the number of stones in each pile. Requirements: takes the user input and reduces the array accordingly
alternates between player 1 & player 2
displays the status of the pile of stones
It will determine who wins and let you play again.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
