Skip to content

parsapoorsh/TicTacToe-XO-Ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TicTacToe-XO-Ai

The best Tic Tac Toe move generator with alpha beta pruning algorithm (improved minimax) with many features

Ai Move

>>> 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

>>> Board(3)
+---+---+---+
|   |   |   |
+---+---+---+
|   |   |   |
+---+---+---+
|   |   |   |
+---+---+---+
>>> Board(4)
+---+---+---+---+
|   |   |   |   |
+---+---+---+---+
|   |   |   |   |
+---+---+---+---+
|   |   |   |   |
+---+---+---+---+
|   |   |   |   |
+---+---+---+---+

TODO

  • add max_depth to ai_move
  • ai_move using multiple cores
  • cache moves in a file

About

Best move generator algoritm. 3x3, 4x4 and more without limits.

Topics

Resources

License

Stars

Watchers

Forks

Languages