How elegantgx/snakecli works
Snake CLI is a terminal Snake game. Its main workflow is command-line handling, watchdog-managed game startup, terminal validation and ncurses setup, then menu selection and gameplay through pause, finish, and return/exit states. The graph also preserves the documented size-check mode, About screen, apple generation, and logical-to-physical rendering. Some gameplay implementation is excerpted only partially, so unshown internal calls are omitted; README statements support the watchdog and documented feature links.
Main entry points: game.c Game runtime · menu.c Main menu · main.c CLI entry · play.c Play state machine
Components 15
Runtime lifecycle
- CLI entry
main.c - Watchdog loop
main.c - Game runtime
game.c - Environment gate
game.c
Terminal interface
- Main menu
menu.c - About screen
menu.c
Snake gameplay
- Play state machine
play.c - Movement and collision
play.c - Apple generation
play.c - Cell rendering
play.c
Shared utilities
- Command modes
utils.c - Option selection
utils.c - Centered text
utils.c
Other components
- Player
- Terminal
Connections 18
- Player → CLI entry: starts
README.md - CLI entry → Command modes: checks arguments
main.c - CLI entry → Watchdog loop: enters loop
main.c - Watchdog loop → Game runtime: runs child
main.c - Watchdog loop → Game runtime: restarts on resize
README.md - Game runtime → Environment gate: checks terminal
game.c - Game runtime → Main menu: dispatches MENU
game.c - Game runtime → Play state machine: dispatches PLAY
game.c - Main menu → About screen: shows About
menu.c - Main menu → Option selection: uses selection
menu.c - Main menu → Centered text: prints centered text
menu.c - Play state machine → Movement and collision: runs playing state
play.c - Play state machine → Option selection: creates state menus
play.c - Movement and collision → Apple generation: generates apple
README.md - Movement and collision → Cell rendering: renders cells
README.md - Command modes → Terminal: checks dimensions
utils.c - Environment gate → Terminal: validates size and color
game.c - Cell rendering → Terminal: draws color blocks
README.md