How jtr-0901/pychess works
This is a Kivy chess app for playing against an AI or in pass-and-play timed matches, then viewing saved games. The workflow starts in the menu, selects an opponent difficulty or match time, and enters a game where the board UI submits moves to chess rules; AI moves are requested by the game screen. Completed games are saved to SQLite and surfaced in history. The excerpts show the main calls, but omit parts of the screen implementation, so some screen-to-screen and history-reading links are based on the source index rather than inspected method bodies.
Main entry points: screens.py Game session · history.py Game records · main.py Kivy app · board.py Board and input
Components 12
App and navigation
- Kivy app
main.py - Screen flows
ui/screens.py - Difficulty choice
ui/screens.py - Timed modes
ui/screens.py
Chess gameplay
- Game session
ui/screens.py - Board and input
ui/board.py - Chess rules
engine/chess_logic.py - AI move search
engine/ai.py
Game history
- History view
ui/screens.py - Game records
database/history.py - SQLite database
chess_history.db
Other components
- Player
Connections 18
- Player → Kivy app: launches
main.py - Kivy app → Game records: initializes
main.py - Kivy app → Screen flows: registers screens
main.py - Player → Screen flows: chooses mode
ui/screens.py - Screen flows → Difficulty choice: opens
ui/screens.py - Screen flows → Timed modes: opens
ui/screens.py - Difficulty choice → Game session: starts bot game
ui/screens.py - Timed modes → Game session: starts timed game
ui/screens.py - Game session → Board and input: creates board
ui/screens.py - Board and input → Chess rules: queries and submits moves
ui/board.py - Game session → Chess rules: checks game state
ui/screens.py - Game session → AI move search: requests move
ui/screens.py - AI move search → Game session: returns move
ui/screens.py - Game session → Board and input: dispatches bot move
ui/screens.py - Game session → Game records: saves completed game
ui/screens.py - Game records → SQLite database: reads and writes
database/history.py - Screen flows → History view: opens history
ui/screens.py - History view → Game records: loads records
ui/screens.py