This small Python project implements a Tic-Tac-Toe game with a Minimax-based AI. The code is structured as a set of modules exposing simple APIs so you can import functions from other code or run the game interactively.
board_api.py– board utilities (create, place, undo, winner check, etc.)ai_api.py– AI logic includingminimaxandcompute_best_movegame_api.py– higher‑level helpers for running the game and movesmain.py– CLI entry point (python main.pyto start)tests/test_game.py– basic pytest suite verifying core behaviors
# run the game
py main.py
# run tests
py -m pytest tests/test_game.pyThe AI returns the best move as (row, col) and can be invoked from other
code via from ai_api import compute_best_move.
You can build a GUI or web frontend by calling the API functions above. The logic is isolated from the user interface for easy reuse and testing.