TicTacToeAI
The AI is based on the minimax algorithm. Either the computer will win or the game will end in a draw (only if the user plays perfectly).
Sample Output:
Welcome to Tic-Tac-Toe! Enter 1 if you would like to go first or 2 if you would like to go second.
2
Current board:
_ _ _
_ _ _
_ _ _
Current board:
x _ _
_ _ _
_ _ _
Enter row and col
0
1
Current board:
x o _
_ _ _
_ _ _
Current board:
x o _
x _ _
_ _ _
Enter row and col
2
0
Current board:
x o _
x _ _
o _ _
Current board:
x o _
x x _
o _ _
Enter row and col
2
2
Current board:
x o _
x x _
o _ o
Current board:
x o _
x x x
o _ o
Computer won!