experiment.experiment module¶
-
class
experiment.experiment.Experiment¶ Bases:
object-
calculate_metrics()¶ Called after earch tick of the simulation. Should return a dictionary of named metrics.
Returns: A dictionary of named metrics.
-
controller(event, coords)¶ Called to control the simulation.
Parameters: - event – The control event
- coords – The world coordinates the mouse is currently at
-
get_world()¶ Get the world generated by this experiment.
Returns: The world generator by this experiment. Return type: model.world.World
-
halt(t)¶ Called before each tick of the simulation. Should return a boolean indicating whether the simulation should be halted.
Parameters: t – The current simulation time (first tick is 0, the second tick 1, etc.) Returns: A boolean indicating whether the simulation should be halted.
-
load_agent(file_name)¶ Load an agent from file.
Parameters: file_name – The name of the file to load the agent from (e.g., “20161118T035805 - Agent DZX26I.p”). Returns: The loaded agent.
-
static
load_experiment(file_name)¶ Load an experiment from file.
Parameters: file_name – The name of the file to load the experiment from (e.g., “20161118T035805.p”). Returns: The loaded experiment.
-
load_world(file_name)¶ Load a world from file.
Parameters: file_name – The name of the file to load the world from (e.g., “20161118T035805.p”). Returns: The loaded world.
-
mapper(symbol)¶ Parse a symbol to a world entity.
Parameters: symbol – The symbol to parse to an entity. Returns: The entity to be placed in the world. Return type: model.world.Entity
-
parse_world(world_repr, mapper=None)¶ Parse a representation of a world to a world.
Parameters: - world_repr – A list of strings that represent a world.
- map – A function that maps symbols to objects.
Returns: The world.
Return type:
-
world= None¶
-