How achrafmaz/tic-tac-toe works
This repository contains two standalone Pygame Tic-Tac-Toe games: a two-human version and a version where the computer chooses random moves. In each, mouse events drive turns, moves update a NumPy board and draw marks, and the game loop checks for wins or a draw. The files are self-contained rather than sharing runtime modules. The README confirms the Pygame product; the detailed relationships below are supported by the sampled source.
Main entry points: tic_tac_toe.py Two-player loop · tic_tac_toe_AI.py AI game loop
Components 11
Two-player game
- Two-player loop
tic_tac_toe.py - Player move handlers
tic_tac_toe.py
Random-AI game
- AI game loop
tic_tac_toe_AI.py - Human and AI moves
tic_tac_toe_AI.py
Game mechanics
- Board state
tic_tac_toe.py - Pygame drawing
tic_tac_toe.py - Win and draw checks
tic_tac_toe.py - AI board state
tic_tac_toe_AI.py - AI game drawing
tic_tac_toe_AI.py - AI win and draw checks
tic_tac_toe_AI.py
Other components
- Human player
Connections 10
- Human player → Two-player loop: clicks cells
tic_tac_toe.py - Two-player loop → Player move handlers: dispatches turns
tic_tac_toe.py - Player move handlers → Board state: updates
tic_tac_toe.py - Player move handlers → Pygame drawing: draws marks
tic_tac_toe.py - Two-player loop → Win and draw checks: checks outcomes
tic_tac_toe.py - Human player → AI game loop: clicks cells
tic_tac_toe_AI.py - AI game loop → Human and AI moves: dispatches moves
tic_tac_toe_AI.py - Human and AI moves → AI board state: updates
tic_tac_toe_AI.py - Human and AI moves → AI game drawing: draws marks
tic_tac_toe_AI.py - AI game loop → AI win and draw checks: checks outcomes
tic_tac_toe_AI.py