How gianpgunawan/minesweeper works
This is a small terminal Minesweeper game implemented in one C file. The player moves a cursor, reveals cells, and flags suspected mines; the game generates a minefield, calculates adjacent counts, reveals connected empty areas, and renders the board and outcome. The main loop coordinates these actions. All components point to main.c; the excerpts show the key calls, but omitted lines limit detail about some internal behavior.
Main entry points: main.c Game loop
Components 11
Game control
- Game loop
main.c
Board logic
- Board setup
main.c - Random coordinate
main.c - Mine placement
main.c - Number placement
main.c - Adjacent mine count
main.c - Area reveal
main.c
Terminal interface
- Key input
main.c - Board renderer
main.c
Other components
- Player
- Terminal
Connections 10
- Player → Game loop: plays
main.c - Game loop → Board setup: initializes
main.c - Board setup → Mine placement: places mines
main.c - Board setup → Number placement: places numbers
main.c - Mine placement → Random coordinate: chooses locations
main.c - Number placement → Adjacent mine count: counts mines
main.c - Game loop → Key input: reads keys
main.c - Game loop → Area reveal: reveals area
main.c - Game loop → Board renderer: renders board
main.c - Board renderer → Terminal: prints board
main.c