Course Assignment
Java TicTacToe Game with Artificial Intelligence.
Sample run:
╔╦╗╦ ╔═╗ ╔╦╗╔═╗╔═╗ ╔╦╗╔═╗╔═╗
║ ║ ║ ║ ╠═╣║ ║ ║ ║║╣
╩ ╩ ╚═╝ ╩ ╩ ╩╚═╝ ╩ ╚═╝╚═╝
Let's play Tic Tac Toe!
By Yehya Awad - yha5009
Start game!
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
Player's turn
Enter the position you want to play: 1
| X | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
Computer's turn
| X | 2 | 3 |
| 4 | 5 | O |
| 7 | 8 | 9 |
Player's turn
Enter the position you want to play: 2
| X | X | 3 |
| 4 | 5 | O |
| 7 | 8 | 9 |
Computer's turn
| X | X | O |
| 4 | 5 | O |
| 7 | 8 | 9 |
Player's turn
Enter the position you want to play: 5
| X | X | O |
| 4 | X | O |
| 7 | 8 | 9 |
Computer's turn
| X | X | O |
| 4 | X | O |
| 7 | 8 | O |
-------------------------------
---------- GAME OVER ----------
-------------------------------
.----.
.---------. | == |
|.-"""""-.| |----|
|| || | == |
|| || |----|
|'-.....-'| |::::|
`"")---(""` |___.|
/:::::::::::" _
/:::=======:::\`\`\
`"""""""""""""` '-'
COMPUTER IS VICTORIOUS
Computer says: You left yourself wide open Human!
New game? (y/n) y
Start game!
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
Player's turn
Enter the position you want to play: 5
| 1 | 2 | 3 |
| 4 | X | 6 |
| 7 | 8 | 9 |
Computer's turn
| 1 | 2 | 3 |
| 4 | X | 6 |
| 7 | O | 9 |
Player's turn
Enter the position you want to play: 5
Error: Invalid input entered. Enter a number from the available spots.
| 1 | 2 | 3 |
| 4 | X | 6 |
| 7 | O | 9 |
Player's turn
Enter the position you want to play: 6
| 1 | 2 | 3 |
| 4 | X | X |
| 7 | O | 9 |
Computer's turn
| 1 | 2 | 3 |
| O | X | X |
| 7 | O | 9 |
Player's turn
Enter the position you want to play: 7
| 1 | 2 | 3 |
| O | X | X |
| X | O | 9 |
Computer's turn
| 1 | 2 | O |
| O | X | X |
| X | O | 9 |
Player's turn
Enter the position you want to play: 2
| 1 | X | O |
| O | X | X |
| X | O | 9 |
Computer's turn
| O | X | O |
| O | X | X |
| X | O | 9 |
Player's turn
Enter the position you want to play: 9
| O | X | O |
| O | X | X |
| X | O | X |
It's a DRAW!
New game? (y/n) n
____ ____ ____ ___ ___ _ _ ____ |
| __ | | | | | \ |__] \_/ |___ |
|__] |__| |__| |__/ |__] | |___ O