ethicalgardeners.renderer.Renderer¶
- class ethicalgardeners.renderer.Renderer(display=False)[source]¶
Bases:
ABCAbstract base class defining the interface for environment visualization.
This class provides the foundation for different rendering strategies. It supports both real-time visualization during simulation execution and post-analysis recording for later video export.
Renderers are responsible for visually representing all elements of the simulation environment, including the grid world, agents, flowers, and pollution levels.
- __init__(display=False)[source]¶
Create the renderer.
- Parameters:
display (bool, optional) – Flag to enable rendering. If True, the renderer will display the environment. Defaults to False.
Methods
__init__([display])Create the renderer.
Display the rendered frame in the rendering window.
Finalize the rendering process.
init(grid_world)Initialize the renderer with the grid world environment.
render(grid_world, agents)Render the current state of the grid world.
- abstractmethod display_render()[source]¶
Display the rendered frame in the rendering window.
This method is called to update the rendering window with the current frame. It should be implemented in concrete renderers.
- end_render()[source]¶
Finalize the rendering process.
This method is called at the end of simulation to perform cleanup tasks and finalize any outputs.
- init(grid_world)[source]¶
Initialize the renderer with the grid world environment.
This method is called once at the beginning of simulation to set up the rendering environment based on the grid world properties.
- Parameters:
grid_world (
GridWorld) – The grid world environment to be rendered.