The final project you have been given is to create a GUI which will allow the user or users
to play several different games on the computer. These games the user will be allowed to choose
between will be tic-tac-toe, connect-four and hangman.
The user will be presented with a base GUI which allows you to choose which game you wish to
play. You may use radio buttons or a dropdown menu for the selection of the different games.
There should also be slots for the users to enter their names. The defaults should be Player1
and Player2. Upon being selected, this GUI should create another JFrame that in which the
selected game will be played.
For tic-tac-toe, the JFrame should have a three by three grid, in which the selected section
changes from a blank to either a circle or an x based on whose turn it is to play. Mouse events
are very useful for this. You do not need to construct an AI to play against. The circles and
x�s should not change if they are clicked on after they have already been set, nor should the
turn change if there is a misclick. This should be a fully functional game. It should also pop
open some sort of window when the game is over to announce whether it is a tie or to congratulate
the winner (Or mock the loser based on your preference). It should also offer the option to
play again or quit the game and return to the root GUI. There should also be menus for altering
the coloring and images that appear inside of the grids when they are clicked.
For the connect-four game, there should be a eight-by-six grid(or however large you wish to
make it) in which different colored circles appear in the lowest unoccupied slot in the column
you click on. After each click, a method which checks whether or not the game is over should
be run. It should examine all the spaces around the most recent addition and determine whether
or not there are four in a row of the same color. There should be menus to allow for color
change of the circles. Upon completion of the game or when all the slots are full, a window
should appear to congratulate the winner or berate the loser and offer the choices of a new
game or a return to the root GUI.
In the Hangman game, you should offer the option for one of the players to enter a word for
the other to guess. If there is no other player, have a word be randomly selected from a list
you had created and stored in the code beforehand. There should be space for the graphics of
the hanging man to slowly be drawn, as well as spaces where the correctly and incorrectly
guessed letters will appear. Upon completion, the same window congratulating and offering a
new game or not should appear.
You may use whatever JFrame components you wish to assemble these games as long as they
function properly.
|