How josh-ay/tic-tac-toe works
This is a small, terminal-based Tic Tac Toe game. The user chooses a marker and numbered square; main.py coordinates input, alternates the user's move with a random computer move, checks for a winner, displays the outcome, and offers replay. Brain tracks available squares and evaluates winning lines, while Board stores and updates the displayed board. The optional-looking screen-clear behavior uses pyautogui; source excerpts show its call but not how it behaves across environments.
Main entry points: main.py Game coordinator · brain.py Rules and options · clear.py Screen clearing · board.py Board state
Components 7
Game flow
- Game coordinator
main.py
Game logic
- Rules and options
brain.py - Board state
board.py
Terminal display
- Screen clearing
clear.py
Other components
- Player
- pyautogui
- Python random
Connections 7
- Player → Game coordinator: enters moves
- Game coordinator → Rules and options: calls game methods
- Game coordinator → Board state: creates and updates
- Game coordinator → Python random: chooses computer move
- Game coordinator → Screen clearing: requests clearing
- Rules and options → Board state: reads board
- Screen clearing → pyautogui: uses controls