This console program allows you to read Neural Network from the network-easy.txt, network-medium.txt or network-hard.txt file and play the Tic Tac Toe console Game.
To play the game run:
.\mvnw.cmd clean package
java -jar .\target\tic-tac-toe-game-1.0.jarThe Neural Network is based on Perceptron [1] and trained by Q-Learning [2] data with the program from repository [3].
Neural network parameters
| Game difficulty | Network parameters | How often the model identifies the optimal move, % |
|---|---|---|
| Easy | 66 | 54.6 |
| Medium | 180 | 75.9 |
| Hard | 1225 | 98.4 |
[1] Perceptron
[2] Q-Learning
[3] Neural Network
Example of one game:
> java -jar .\target\tic-tac-toe-game-1.0.jar
1) Easy
2) Medium
3) Hard
Choose Difficulty [1-3]: 3
1) X player
2) O player
Select a player [1-2]: 1
| 1 | 2 | 3 |
-------------
| 4 | 5 | 6 |
-------------
| 7 | 8 | 9 |
Move with 'X' to space [1-9]: 6
| | | |
-------------
| | | X |
-------------
| | | |
AI move: 3
| | | O |
-------------
| | | X |
-------------
| | | |
Move with 'X' to space [1-9]: 4
| | | O |
-------------
| X | | X |
-------------
| | | |
AI move: 5
| | | O |
-------------
| X | O | X |
-------------
| | | |
Move with 'X' to space [1-9]: 7
| | | O |
-------------
| X | O | X |
-------------
| X | | |
AI move: 1
| O | | O |
-------------
| X | O | X |
-------------
| X | | |
Move with 'X' to space [1-9]: 2
| O | X | O |
-------------
| X | O | X |
-------------
| X | | |
AI move: 9
| O | X | O |
-------------
| X | O | X |
-------------
| X | | O |
Good game, but you lost