Tic Tac Toe
Tic Tac Toe puts you against an AI opponent that uses the minimax algorithm to play optimally. The game is played on a standard 3x3 grid. You are X (orange) and the AI is O (blue). Players take turns placing their marks in empty cells. Three marks in a row (horizontally, vertically, or diagonally) wins the game. If all nine cells are filled without a winner, the game is a draw. The AI's strategy is based on optimal play: it first checks if it can win immediately, then checks if it needs to block your winning move, then prioritizes the center square, and finally selects a corner or side square. Against optimal play, the game always results in either a win for the starting player (if the opponent makes a mistake) or a draw (if both players play perfectly).
Tic Tac Toe is a solved game — with perfect play from both players, the game always ends in a draw. The first player has a slight advantage and can force a win if the second player makes a single mistake. Our AI is designed to challenge casual players while never making intentionally "dumb" moves to let the player win. This creates a fair test of the player's strategic ability. The game tracks three statistics across sessions: wins, losses, and draws. These are saved to localStorage so you can track your improvement over time. The visual interface uses a clean grid layout with animated mark placements. When a player wins, the winning row is highlighted with a pulsing animation. The game is fully DOM-based for instant loading, with no Canvas dependency. Touch targets are at least 48px on mobile, exceeding Google's mobile usability guidelines. The AI's moves are deliberately delayed by 300ms to simulate natural thinking time.