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 40players 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, moe).Players 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 5players, with a "count size" of 2:
12345//Start; "current" player is 1
1245//Count two steps over from 1to land on 3; eliminate 3
124//Count two steps over from 3to land on 5; eliminate 5
14//Count two steps over from 5,wrapping around to the beginning and eventually landing on 2; eliminate 2
4//Count two steps over from 2: 3is gone so the first step is 4,and 5is gone so the second step wraps around to find 1; eliminate 1
//Only one player (#4)remains, so the winner is 4
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 of)and 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 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!