Question: Make a graphical application in java that works out the winner of a counting game. The game works like this. From two to 4 0
Make a graphical application in java that works out the winner of a counting game.
The game works like this. From two to players start the game, standing in a circle. Going around the circle clockwise, starting at player one, count n times, and eliminate the player you land on like Eeny, meeny, miny, moePlayers who are eliminated are skipped over in future counts. Keep doing this until only one player is left; that player is the winner.
Example:
Game with players with a "count size" of :
Start; "current" player is
Count two steps over from to land on ; eliminate
Count two steps over from to land on ; eliminate
Count two steps over from wrapping around to the beginning and eventually landing on ; eliminate
Count two steps over from : is gone so the first step is and is gone so the second step wraps around to find ; eliminate
Only one player #remains so the winner is
The program has two parts. The first part is the game logic. When I got this assignment in school, I had to write a custom circular doubly linked list to keep track of the players. That helped because that version of the assignment allowed going around the circle in either direction.But since our schedule changed and we haven't talked about data structures yet, you can keep things simple sort ofand use a plain old array or other data structure of your choice.
The second part is the GUI. You will draw all players on the screen, noting which players are eliminated. This doesn't have to be fancy, you can represent players as simple numbered circles.
The screen should also have a button that the user can click to run the next step and eliminate the next player. You should indicate the winning player when they are known, and provide some way to start over with a new game.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
