How zaxhutchinson/microworld2 works
Microworld 2 is a turn-based grid simulation in which configured agents explore a map, perceive nearby cells and hazards, choose AI commands, and earn or lose points as they act. The main loop coordinates world queries, agent decisions, action resolution, and the SFML display; the world tracks mines, treasure, and teleporters. The graph reflects the shown loop and world implementation. Other world files and unsampled modules are represented only where their role is supported by the tree or source index.
Main entry points: main.cpp Simulation loop · world.cpp World state and rules · agent.cpp Agent state · ai.cpp Agent AI
Components 13
Simulation runtime
- Simulation loop
src/main.cpp
World and rules
- World state and rules
src/world.cpp - World maps and configs
worlds - JSON parser
src/json.hpp
Agents and decisions
- Agent state
src/agent.cpp - Agent AI
src/ai.cpp - Percepts and symbols
src/percepts.hpp - Agent commands
src/ai.hpp - Agent signals
src/comm.hpp
Rendering and shared types
- SFML display
src/display.cpp - World configuration types
src/defs.hpp - Grid coordinates
src/vec2.cpp
Other components
- Operator
Connections 17
- Operator → Simulation loop: starts
src/main.cpp - Simulation loop → World state and rules: loads and queries
src/main.cpp - World state and rules → World maps and configs: reads
src/world.cpp - World state and rules → JSON parser: parses config
src/world.cpp - Simulation loop → Agent state: creates and updates
src/main.cpp - Agent state → Agent AI: delegates decisions
src/agent.cpp - Simulation loop → World state and rules: builds percepts
src/main.cpp - Simulation loop → Percepts and symbols: passes percepts
src/main.cpp - Agent state → Percepts and symbols: accepts percepts
src/agent.cpp - Agent AI → Agent commands: returns commands
src/ai.cpp - Simulation loop → World state and rules: resolves actions
src/main.cpp - Simulation loop → SFML display: draws simulation
src/main.cpp - Simulation loop → SFML display: polls events
src/main.cpp - World state and rules → World configuration types: uses configuration
src/world.cpp - World state and rules → Grid coordinates: tracks locations
- Agent AI → Agent signals: accepts signals
- Simulation loop → Agent signals: passes signals
src/main.cpp