The functionalities below are required:
Provide an entry screen as a JPanel containing GUI objects for players to:
Enter Player 1s name
Enter Player 2s name
Have options for either player 1 to start or randomly select who moves first
The dimensions of the board: rectangular, at least 3 but no more than 12 rows & columns
The number of placements in a row required for victory, at least 3 but no more than 6
A button to confirm the selected options and begin play
After confirming the options, gameplay will begin. Display the game board in a different JPanel object, which is updated after each move. This JPanel will have a grid layout of the specified number of rows and columns. Each square should use a subclass of JPanel with custom graphics to display, appropriately, one of the following:
Which squares are unclaimed, shown as blank
Player 1 moves shown as X
Player 2 moves shown as O
All squares should have a solid border to facilitate accurate selection
Gameplay:
Players make moves by using a mouse and clicking on unclaimed squares (assume hotseat, where both players take turns using the mouse) the interface classes MouseListener and MouseMotionListener are recommended
After each move, the game should check for victory or a tie (if no further moves are possible)
If a player selects an invalid move (a square previously selected by either player), the application should throw an Exception. This Exception will be caught and catching it will display a dialog box reminding the player to only select unclaimed squares. Closing the dialog box will resume normal gameplay.
Extra Credit (10pts): Check for a tie, when neither player could possibly get enough placements in a row to win
Games should conclude with a dialog box including:
Announcement of result and congratulations to winner (if any)
Options to exit the application or return to the entry screen and begin a new game
Attempting to close the window should:
Before or after a game: Close the window and exit the game.
During a game: Provide a dialog box asking if the player really wants to quit and options for closing the window (and aborting the game) or not.
X in row (java)
June 24th, 2020