datasim.Entity¶
- class datasim.Entity(world: ~typing.Any, id: str | None = None, initial_state: ~datasim.entity.State | type[~datasim.entity.State] | None = None, gather: bool = False, data_id: str = '', plot_options: ~datasim.types.PlotOptions = <datasim.types.PlotOptions object>)¶
An entity in the simulation world.
This can be anything that exhibits behavior.
- __init__(world: ~typing.Any, id: str | None = None, initial_state: ~datasim.entity.State | type[~datasim.entity.State] | None = None, gather: bool = False, data_id: str = '', plot_options: ~datasim.types.PlotOptions = <datasim.types.PlotOptions object>)¶
Create an entity.
- Parameters:
name (Optional[str], optional) – Descriptive name of the entity. Defaults to None.
initial_state (Optional[State or type], optional) – Initial state of the entity. If using a type, that type needs to have a constructor with only name as paramater. Defaults to None, meaning no behavior will be executed.
Methods
__init__(world[, id, initial_state, gather, ...])Create an entity.
add_output([data_id, plot_options])Create a plot for this Resource.
on_state_entered(old_state, new_state)Implement this function to run when the state starts.
on_state_leaving(old_state, new_state)Implement this function to run when the current state is being left.
remove()Remove this Entity from its World.
Attributes
pluralstateThe current state of the entity.
time_in_current_stateworldidindexticks_in_current_statelocation