๐Ÿ“ฆ SanchithHegde / tic-tac-toe

Tic-Tac-Toe game using the Monte Carlo Tree Search algorithm, implemented in Java.

โ˜… 0 stars โ‘‚ 0 forks ๐Ÿ‘ 0 watching โš–๏ธ MIT License
javamcts-algorithmtictactoe
๐Ÿ“ฅ Clone https://github.com/SanchithHegde/tic-tac-toe.git
HTTPS git clone https://github.com/SanchithHegde/tic-tac-toe.git
SSH git clone git@github.com:SanchithHegde/tic-tac-toe.git
CLI gh repo clone SanchithHegde/tic-tac-toe
Sanchith Hegde Sanchith Hegde LICENSE: Update year 5b010eb 4 years ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .settings
๐Ÿ“ .vscode
๐Ÿ“ src
๐Ÿ“„ .classpath
๐Ÿ“„ .gitignore
๐Ÿ“„ .project
๐Ÿ“„ LICENSE.md
๐Ÿ“„ pom.xml
๐Ÿ“„ README.md
๐Ÿ“„ README.md

Tic-Tac-Toe

Tic-Tac-Toe game using the Monte Carlo Tree Search algorithm, implemented in Java. The MCTS algorithm makes the computer almost impossible to beat, thus the worst case scenario (for the computer) would be a draw.

Requirements

  • Java (JDK and JRE)

Compile and Run

# Compile all files
$ javac src/me/sanchithhegde/tictactoe/*.java -d target/classes 

# Execute driver class' main method
$ java -classpath target/classes me.sanchithhegde.tictactoe.App

target/classes can be replaced with any directory of your choice. If you do change the output directory, make sure to specify the same directory when running the app.

Board Positions

1 2 3
4 5 6
7 8 9

Features

  • Prints board with colored indicators (printing colors depends on terminal support).
  • Empty positions are shown as white hyphens '-'.
  • Player's indicators are shown with green O's.
  • Computer's indicators are shown as red X's.

References

Monte Carlo tree search - Wikipedia

Monte Carlo Tree Search for Tic-Tac-Toe Game - Baeldung

eugenp/tutorials - GitHub

Contributing

Feel free to submit pull requests or open issues. Please ensure you follow Google's Java Style Guide when making pull requests. Use Checkstyle with your editor if required.

License

MIT