https://github.com/andreacrotti/tic-tac-toe
https://github.com/andreacrotti/tic-tac-toe
algorithm clojure strategy tic-tac-toe
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/andreacrotti/tic-tac-toe
- Owner: AndreaCrotti
- License: epl-1.0
- Created: 2017-05-11T15:49:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-03T12:23:35.000Z (about 8 years ago)
- Last Synced: 2025-02-01T08:30:53.509Z (10 months ago)
- Topics: algorithm, clojure, strategy, tic-tac-toe
- Language: Clojure
- Size: 55.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tic-tac-toe
[](https://travis-ci.org/AndreaCrotti/tic-tac-toe)
## Usage
lein run -c CONFIG_FILE -p PROFILE
Where the default configuration is an
[this EDN file](resources/config.edn), and each profile configures
the initial player, the size of the board and the algorithm
which each player should use.
So for example to play a game with the profile `win-random`, which
makes `p1` use a `win` strategy, and `p2` uses a simple random
strategy, you can run:
$ lein run -p win-random
Winner: :p1
o _ x
x o x
o _ x
Which will show the player who won and what was the last board status.
## TODO
- [x] implement more strategies
- [x] random algorithm
- [x] blocker algorithm, simply try to block the opponent
- [x] best move algorithm
- [ ] store game results with an in memory datascript database
- [ ] generate some interesting reports about the winner, using different strategies
- [ ] make the various algorithm compete against each other and see who the winner is
- [ ] implement a UI with re-frame to show the whole thing up and running
- [ ] add CLI interface reading from stdin
## License
Copyright © 2017 Andrea Crotti
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.