Video Demo: https://youtu.be/v2Cq2IDEJU8
This project is a classic game of Tic-Tac-Toe, implemented in Python with a graphical interface. The game is designed to be a challenging single-player experience, as it features an "unbeatable" AI opponent.
The core of the project is the AI, which uses the Minimax algorithm to determine its moves. Minimax is a decision-making strategy commonly used in game AI. It evaluates all possible moves on the board, assigning a score to each potential outcome. The algorithm always chooses the move that leads to the best possible result for the AI, assuming the human player will also make their best moves. This guarantees that the AI will never lose and will either win the game or force a draw.
The game's interface is built using the pygame
library, which handles the graphics, user input, and game loop. This provides a clean and responsive environment for the player. The game's logic and the AI's algorithm are separated into different files (main.py
and minimax.py
) to maintain a clean and organized codebase.
The simple interface was a deliberate design choice to keep the project's focus on the AI implementation. It allows the player to concentrate on the strategic challenge of playing against the unbeatable opponent, effectively demonstrating the power of the Minimax algorithm in a straightforward and engaging way.