-
Notifications
You must be signed in to change notification settings - Fork 15
/
monitors.py
30 lines (18 loc) · 867 Bytes
/
monitors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .entity import Entity
if TYPE_CHECKING:
from .world import World
__all__ = ["StatsMonitor", "WorldMonitor"]
class StatsMonitor(Entity):
"""A monitor object capable of receiving stats of a world"""
def init(self, stats: dict[str, Any], world_name: str):
"""Called to initialize the monitor before running first step"""
def step(self, stats: dict[str, Any], world_name: str):
"""Called at the END of every simulation step"""
class WorldMonitor(Entity):
"""A monitor object capable of monitoring a world. It has read/write access to the world"""
def init(self, world: World):
"""Called to initialize the monitor before running first step"""
def step(self, world: World):
"""Called at the END of every simulation step"""