Tic Tac Toe

TIc Tac Toe

Your task is to finish a program that will teach the computer to play and win (tie at worst) the game of Tic Tac Toe.  You will be given a program that plays through the 4th move.  You will need to write code to handle the 5th, 7th, and 9th move correctly.  Here are the template programs:


You will ONLY need to use if statements.  You may need to nest the if statements, or you can use the and(&&) extension to the if statement. You may use the else extension to the if statement.  No loops, nothing extra

EXTRA:  Once you have your program working,  here are a few extensions:
Determine who wins and who loses (the computer should never lose)
Let the human player go first
Try a different strategy to play the game
Try a different first move

CHALLENGE:   Write a program that lets the computer learn on its own how to win at TTT.  See me.