Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/parsapoorsh/tictactoe-xo-ai
Best move generator algoritm. 3x3, 4x4 and more without limits.
https://github.com/parsapoorsh/tictactoe-xo-ai
algorithm alpha-beta-pruning minimax tic-tac-toe tictactoe
Last synced: 4 days ago
JSON representation
Best move generator algoritm. 3x3, 4x4 and more without limits.
- Host: GitHub
- URL: https://github.com/parsapoorsh/tictactoe-xo-ai
- Owner: parsapoorsh
- License: gpl-3.0
- Created: 2022-07-28T19:21:37.000Z (over 2 years ago)
- Default Branch: alpha-beta
- Last Pushed: 2023-12-22T20:20:20.000Z (11 months ago)
- Last Synced: 2023-12-22T21:27:32.148Z (11 months ago)
- Topics: algorithm, alpha-beta-pruning, minimax, tic-tac-toe, tictactoe
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TicTacToe-XO-Ai
The best Tic Tac Toe move generator with alpha beta pruning algorithm (improved minimax) with many features## Ai Move
``` python
>>> board.move(5, players.X) # human player
+---+---+---+
| O | X | |
+---+---+---+
| | X | |
+---+---+---+
| | | |
+---+---+---+
>>> board.ai_move(players.O) # move, score, depth
(7, 0, 2)
>>> board
+---+---+---+
| O | X | |
+---+---+---+
| | X | |
+---+---+---+
| | O | |
+---+---+---+
```## Unlimited board
### `3x3`, `4x4`, `NxN` boards can be made
``` python
>>> Board(3)
+---+---+---+
| | | |
+---+---+---+
| | | |
+---+---+---+
| | | |
+---+---+---+
>>> Board(4)
+---+---+---+---+
| | | | |
+---+---+---+---+
| | | | |
+---+---+---+---+
| | | | |
+---+---+---+---+
| | | | |
+---+---+---+---+
```## TODO
- [x] add max_depth to ai_move
- [ ] ai_move using multiple cores
- [ ] cache moves in a file