How jabb4man/42-rushbsq works
BSQ is a command-line solver that reads one or more maps from files or standard input, validates and loads each map, finds the largest empty square, and prints the map with that square marked. Its distinctive algorithm updates per-column heights for each row, scans them with a monotonic stack, and resolves equal-size candidates top-then-left. The sampled sources show the principal flow and output helpers; the README documents multi-map operation and the algorithm. The shared header is included in the graph as the program’s type and function contract.
Main entry points: main.c Map processing · solver.c Tie-breaking · utils.c Output and cleanup · bsq.h Shared declarations
Components 11
Input interface
- Map processing
srcs/main.c - Shared declarations
bsq.h
Map parsing
- Header validation
srcs/parser.c - Map loading
srcs/parser.c
Square solving
- Row histograms
srcs/solver.c - Monotonic stack
srcs/solver.c - Tie-breaking
srcs/solver.c
Output
- Square rendering
srcs/output.c - Output and cleanup
srcs/utils.c
Other components
- CLI user
- Standard output
Connections 18
- CLI user → Map processing: provides maps
README.md - Map processing → Header validation: validates header
srcs/main.c - Map processing → Map loading: loads map
srcs/main.c - Map processing → Tie-breaking: solves map
srcs/main.c - Map processing → Output and cleanup: reports errors
srcs/main.c - Map processing → Output and cleanup: frees map
srcs/main.c - Map loading → Output and cleanup: frees partial map
srcs/parser.c - Tie-breaking → Row histograms: updates heights
srcs/solver.c - Tie-breaking → Monotonic stack: scans histogram
srcs/solver.c - Monotonic stack → Tie-breaking: updates candidate
srcs/solver.c - Tie-breaking → Square rendering: prints result
srcs/solver.c - Square rendering → Output and cleanup: writes characters
srcs/output.c - Output and cleanup → Standard output: writes output
srcs/utils.c - Map processing → Shared declarations: includes declarations
srcs/main.c - Header validation → Shared declarations: includes declarations
srcs/parser.c - Tie-breaking → Shared declarations: includes declarations
srcs/solver.c - Square rendering → Shared declarations: includes declarations
srcs/output.c - Output and cleanup → Shared declarations: includes declarations
srcs/utils.c