How link-wolf/lem_in works
Main Components
• Input & File Reading: Represent the command-line interface and the modules that read the map input file or generator output. This component is responsible for fetching the map data.
• Parsing & Graph Creation: Illustrate the parser (in srcs/parsing) that processes the file, ignores comments, handles instructions (like “##start” and “##end”), and builds the internal graph data (rooms, links).
• Data Structures & Utilities: Show the underlying data representations (rooms, tubes/links, ants, etc.) based on headers in “includes” and functions from “libs/libft” for utility routines.
• Algorithm Processing Engine: This component (in srcs/processing and parts of srcs/map_manipulation) contains the core algorithm that computes the quickest path(s) for ants, including sorting paths and managing ant movement (throw_ants, resolve).
• Output Formatter: The areas in srcs/utils and the main files (lem_in.c) assemble the simulation steps and print formatted results (per turn) to the console.
• Bonus Visualizer: Separately, the srcs/visualiser module, which depends on MLX42 (from libs/MLX42), handles graphical output. It takes the same data from the simulation engine and visualizes the ant movements, complete with input hooks and debug options.
Relationships and Data Flow
• The Data Structures then feed into the Algorithm Processing Engine which computes optimal paths.
• The Processing Engine outputs simulation state changes per turn.
• Finally, mention the supplementary map generator (generator_linux) as an optional component that feeds into the Input Module.
Architectural Patterns and Design Principles
• Modular separation – each functionality (parsing, processing, visualization) is isolated in its own folder/module.
• Separation between core simulation logic (algorithm in processing) and various output layers (console vs. graphical).
• The use of libraries (libft for common C routines; MLX42 for graphics) shows a layered dependency structure.
Relevant Technologies & Frameworks
• Language: C.
• Graphical Library: MLX42 (responsible for rendering via OpenGL and interfacing with X11).
• Utility Library: libft (providing foundational functions used across the project).
• Build System: Makefile (and CMake for MLX42).