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 2nd move, one X and one 0. You teach the computer to play Xs and always start at the top left, unless you want to try a different strategy. See me if you do. The player will select his 0 position by clicking on a button position that is empty You will need to write code to handle the 3rd, 5th, 7th, and 9th move correctly. Here is the template program:
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.