How zonda-tsai/chess works
This is a two-player terminal chess game. Players enter source and destination squares or game commands; the game loop obtains input, requests promotion when needed, applies and validates moves, updates history and reports terminal outcomes. The renderer handles board display and terminal input mode, while chess_tool.c provides board rules and move history. README-listed capabilities are retained; AI.h is referenced by game.c but absent from the supplied tree, and chess_tool.c is only partially sampled, so uncertain internal wiring is omitted.
Main entry points: game.c Game loop · painter.c Board and status rendering · chess_tool.c Move validation and execution · chess_tool.h Board state
Components 12
Game control
- Game loop
game.c - Move and command input
game.c - Promotion choice
painter.c
Chess rules
- Board state
chess_tool.h - Move validation and execution
chess_tool.c - Checkmate and draw rules
chess_tool.c - Move history and undo/redo
chess_tool.c
Terminal interface
- Board and status rendering
painter.c - Terminal input mode
painter.c - Unicode and ANSI styling
customise.h
Other components
- Player
- Terminal
Connections 19
- Player → Move and command input: enters moves
- Game loop → Move and command input: requests input
- Move and command input → Game loop: returns commands
- Game loop → Promotion choice: requests choice
- Game loop → Move validation and execution: applies move
- Move validation and execution → Board state: updates state
- Move validation and execution → Move history and undo/redo: records move
- Game loop → Move history and undo/redo: undoes or redoes
- Game loop → Checkmate and draw rules: checks result
- Game loop → Board and status rendering: draws game
- Board and status rendering → Board state: reads position
- Board and status rendering → Move history and undo/redo: reads moves
- Move and command input → Board and status rendering: displays prompts
- Promotion choice → Terminal: reads choice
- Terminal input mode → Terminal: configures input
- Move and command input → Terminal: reads keys
- Board and status rendering → Terminal: writes display
- Board and status rendering → Unicode and ANSI styling: uses symbols
- Game loop → Terminal input mode: enables mode