Variation of minimax algorithm is used to play the game. AI chooses next possible winning position of board and thus drawing or winning the game.
All valid board positions of tic-tac-toe game are discovered through constructing tree.
Given graph and heuristics, this algorithm calculates best possible path from source to destination.
Given 2 sat problem and beam width, this search can give the feasibility of finding solution.
Given a AND OR graph, AO* algorithms gives minimum cost for the graph
These codes are not perfect... But can give you idea how respective algorithms works. Use your imagination and write your own code from scratch.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
A First Course in Artificial Intelligence Book by Deepak Khemani