swarmsim.world#
Houses World modules.
Worlds are the root of the simulation.
All worlds must inherit from World
The world is simulated by the simulate
module.
Subpackages
Functions#
- swarmsim.world.World.World_from_config(config: dict)[source]
Returns a new world instance from the given config.
- Parameters:
config (dict | WorldConfig) –
The config to create the world from.
The config should either be a dict with a
'type'
key, or an instance ofAbstractWorldConfig
with anassociated_type
field (which can be set using@~swarmsim.config.associated_type
).The Configuration System will be used to lookup the class for the world type.
- Returns:
A new world of type
config['associated_type']
orconfig.associated_type
.- Return type:
- swarmsim.world.World.config_from_dict(d: dict)[source]
Create a world config dataclass from a dict.
- Parameters:
d (dict) –
The dict to create the world config from.
Must have a ‘type’ key that specifies the world type as a string.
- Returns:
Returns a dataclass of the world config. The type of the dataclass is determined by the ‘type’ key in the dict.
- Return type:
dataclass
- Raises:
ValueError – Raised if the dict does not have a ‘type’ key.
IndexError – Raised if the world type is not found in the registry.
Modules
2D world module. |
|
Base world class. |
|