simulation package

Submodules

simulation.engine module

class simulation.engine.SimulationEngine(grid_size=20, steps=30, foodweb_path='configs/foodweb_config.json')[source]

Bases: object

Controls and runs the ecosystem simulation.

Handles grid setup, population initialization, step-wise organism behavior, reproduction, and visualization including population tracking and heatmaps.

__init__(grid_size=20, steps=30, foodweb_path='configs/foodweb_config.json')[source]

Initialize simulation parameters and state.

Parameters: grid_size (int): Size of the simulation grid. steps (int): Total number of simulation steps. foodweb_path (str): Path to food web configuration JSON.

setup()[source]

Populate the grid with initial organisms based on food web configuration.

Organisms are placed randomly avoiding blocked or occupied terrain. Sets up internal reproduction and decomposition parameters.

run()[source]

Execute the simulation over the predefined number of steps.

Organisms act each step based on their roles (Producer/Consumer), terrain effects are applied, population data is updated, and visual outputs such as organism plots and heatmaps are generated.

Module contents