The Tic Tac Toe Assignment

The game is to play tic tac toe.  There should be the standard tic tac toe board, with squares numbered 1 ... 9.  When the user types 1 number, place an 'X' in that square.  Then have the computer place a 'O' in an unclaimed square.  If someone wins, or there have been 9 moves, end the game.


Points Feature
.001 Draws the board
.001 Puts 'X' when the human types a digit.
.001 Prevents the human from claiming an already taken spot
.001 The computer places an 'O' on an unclaimed spot (any method)
.001 The computer always find the winning move is a winning move exists.
.001 The computer moves in a random way
.001 The game can tell if someone has won
.001 There is an introductory screen.
.001 There is a help screen
.001 No method is more than 50 lines long
.001 The computer taunts the user
.012 TOTAL


How to write a program with multiple modes (like play-the-game, help-screen, intro, etc)

int mode=1; // 1 =intro, 2=play, 3=help, 4=won

public void paint(...)
{
    if (mode == 1)
        intro(g);
    else if (mode == 2)
        game(g);
    else if ....
}



public void keypressed( ..)
{
    // stuff
    if (letter == 'h')
        mode = 3; // go to help mode
    else if (letter == 'q' && mode == 3)
        mode = 2; // if they type 'q' in help mode, go back to game mode
    // more stuff
}
}