You are required to implement a GUI to play Tic Tac Toe using Java. A screen dump of the running program is available. This will give you an idea of the scope of the project.
Your GUI should extend a JFrame and consists of two JPanels (one black, one pink).
The black panel should have 9 yellow panels to support the game. The pink panel supports three labels and associated JTextFields and one button. The colours **must** be as described.
Play is by clicking on a panel. The demo changes the colour but you can substitute an icon for "X" and "O" if you wish. The game should stop when a winner is announced or 9 moves have been made. The game should announce a draw when appropriate.
You will need to keep an internal representation of the game, as well as the GUI, for checking for wins, draws etc.
| Criteria looking at GUI | Mark |
|:---------------------------------------------------------------------------- |:------- |
| program compiles without errors | assumed |
| program runs and terminates when window closes | 5% |
| title "Tic Tac Toe Game" appears | 5% |
| 9 yellow playareas on black background at top of GUI | 5% |
| pink panel at bottom of GUI | 5% |
| "next to play" text and associated textfield exist | 5% |
| associated textfield initialised to "x" | 5% |
| "status" text and associated textfield exist | 5% |
| "result" text and associatedtextfield exist | 5% |
| "new game" button exists | 5% |
| playarea turns red(green) when X(O) clicks | 5% |
| click or red or green area causes "illegal move" to appear in status field | 5% |
| "illegal move" disappears as cursor moves out of box | 5% |
| "next to play" changes on each move | 5% |
| on a winning move, "win for X/O" appears in result | 5% |
| after 9 moves and no winner, "Drawn Game" appears | 5% |
| restart button sets boxes yellow, "X" next to play, clears status and result | 5% |
| "X" (red) first to play in restarted game | 5% |
| No move beyond 9th should be recognised i.e. no "illegal Move" message | 5% |
| | |
| | |
Criteria looking at code
* expect to see use of array or vector of panels, not 9 different variables
* general quality of code
* private variable
Above criteria might be altered slightly to take account of submissions which vary in unexpected ways but the items of concern will not alter although the weighting might alter slightly.
Submit a single java file only. The file needs to compile and run. your code
Run on Windows PC platform using IE or Netscape