Hierarchy Chart
There are two classes and one interface used in each of the fully developed versions of tic tac toe. Essentially the only difference between these versions of the game is how the computer selects its move.



This hierarchy chart applies to both versions seven and eight of the tic tac toe applet. See the table below for method definitions>
Method NameDescription
initInitializes variables and references used by applet.
Precondition: Browser calls applet
Postcondition: variables and references initialized.
mouse_ReleasedCalled whenever mouse released in applet area.
Precondition: Click of mouse.
Postcondition: plotMove(MouseEvent) called
plot_MoveDetermines game condition and where mouse clicked and calls various methods.
Precondition: Call from mouseReleased.
Postcondition: t.computer_move() or t.human_move() called and then applet repainted.
init_gameInitializes main variables used in game.
Precondition: Call from init() or plotMove() of t8.
Postcondition: Empty board and other variables set for start of game.
human_moveStores human move in array.
Precondition: Call from plotMove in applet.
Postcondition: Human move stored and flag set for computer to make move.
computer_moveCalls miniMax to decide on best move and then stores move in position array. Also displays information regarding algorithm efficiency and calls function to check for winning state.
Precondition: Call from plotMove in applet.
Postcondition: Computer's move made and flag set for human to make move.
minimaxSearches for best move for computer.
Precondition: Call from computer_move method.
Postcondition: Stores best move in bestc and bestr.
evaluateReturns value of possible moves.
Precondition: Call from miniMax method.
Postcondition: Returns a value which indicates affect of possible move: human win, computer win, cat's game, or game not finished.
winDetects if a win exists and identifies its direction
Precondition: Call from computer_move() or human_move().
Postcondition: Identifies direction of win, if one exists.
paintCalls drawBoard and plotWin to display current game state.
Precondition: Called after init method and by plotMove() method through use of repaint() method.
Postcondition: Display of game state updated.
drawBoradDraws grid and players in their positions.
Precondition: Call from paint(Graphics g)
Postcondition: Current state of game displayed
plotWinDraws a line highlighting path of win.
Precondition: Called by paint(Graphics g). Only actually does anything if a winning pattern exists.
Postcondition: A winning pattern is highlighted if one exists.