How tyreece614/simulation works
This is a small SFML predator–prey simulation. The main workflow creates populations, renders them in a window, moves prey away from nearby predators and predators toward nearby prey, then removes caught prey. Core animal state and distance calculation support that loop. The README also describes a developing menu and future user controls, but the tree and excerpts do not identify an implementing module. The dev/ tree duplicates the main source; its runtime role is unclear, so it is shown separately without inferred connections.
Main entry points: Simulation.cpp Simulation and rendering · Prey.cpp Prey behavior · dev/Simulation.cpp Development simulation copy · dev/Prey.cpp Development prey
Components 13
Simulation loop
- Simulation and rendering
Simulation.cpp - Population and targeting
Simulation.cpp - Overlap and catch removal
Simulation.cpp
Animal model
- Animal state
Animal.cpp - Predator behavior
Predator.cpp - Prey behavior
Prey.cpp
Shared support
- Distance utility
Utilities.cpp
Development copy
- Development simulation copy
dev/Simulation.cpp - Development animal state
dev/Animal.cpp - Development predator
dev/Predator.cpp - Development prey
dev/Prey.cpp - Development distance utility
dev/Utilities.cpp
Other components
- User
Connections 16
- User → Simulation and rendering: opens window
README.md - Simulation and rendering → Population and targeting: creates populations
Simulation.cpp - Simulation and rendering → Predator behavior: renders and moves
Simulation.cpp - Simulation and rendering → Prey behavior: renders and moves
Simulation.cpp - Simulation and rendering → Overlap and catch removal: checks catches
Simulation.cpp - Population and targeting → Predator behavior: creates and targets
Simulation.cpp - Population and targeting → Prey behavior: creates and targets
Simulation.cpp - Predator behavior → Animal state: inherits state
- Prey behavior → Animal state: inherits state
- Prey behavior → Distance utility: measures distance
Prey.cpp - Development simulation copy → Development animal state: uses state
- Development simulation copy → Development predator: uses predator
- Development simulation copy → Development prey: uses prey
- Development predator → Development animal state: inherits state
- Development prey → Development animal state: inherits state
- Development prey → Development distance utility: measures distance