https://github.com/aiyan/tictactoe
A blazing-fast, optimal tic-tac-toe agent written in C++
https://github.com/aiyan/tictactoe
Last synced: about 2 months ago
JSON representation
A blazing-fast, optimal tic-tac-toe agent written in C++
- Host: GitHub
- URL: https://github.com/aiyan/tictactoe
- Owner: aiyan
- Created: 2020-04-17T04:20:34.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-02T22:29:28.000Z (almost 5 years ago)
- Last Synced: 2024-11-01T18:38:04.049Z (5 months ago)
- Language: C++
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-blazingly-fast - tictactoe - A blazing-fast, optimal tic-tac-toe agent written in C++ (C++)
README
# tictactoe
A blazing-fast, optimal tic-tac-toe agent written in C++.Some of the numerous optimizations made:
- Negamax search with alpha-beta pruning.
- Representation of positions as bitboards and use of bitwise
operators for fast state checking.
- Optimized move-ordering for early cut-offs.
- Transposition table storing the results of previously searched
nodes.
- Leaf evaluation heuristics (leaf nodes are scored based on
the number of moves played and the game result).>This implementation is a _proof of concept_: tic-tac-toe has a
relatively small search tree when compared to games like chess
or Go and can be solved without such optimizations.>However, it demonstrates the application of high-level
search algorithms that can be utilized on _games with
significantly higher complexity._See the performance benchmarking results
(each the average of 10,000 trials):|Initial Board State|Parameters|Mean Time|
|----|----|----|
|Empty|Transposition table reset between trials|309 μs|
|Empty|Transposition table preserved between trials|41 μs|You can experiment with the agent for yourself using
`Benchmark.cpp`.