ShellRenderingEngine¶
This module provides a rendering engine using the shell. It will print the game state to the console using ASCII characters and ANSI escape codes for colors.
- class ShellRenderingEngine.ShellRenderingEngine(use_colors=True, clear_each_turn=True, *args, **kwargs)[source]¶
(This class inherits from
RenderingEngine).An ASCII rendering engine is a rendering engine that can render a PyRat game in ASCII. It also supports ANSI escape codes to colorize the rendering.
- __init__(use_colors=True, clear_each_turn=True, *args, **kwargs)[source]¶
Initializes a new instance of the class.
- Parameters:
use_colors (
bool) – Boolean indicating whether the rendering engine should use colors or not.clear_each_turn (
bool) – Boolean indicating whether the rendering engine should clear the screen each turn.args (
object) – Arguments to pass to the parent constructor.kwargs (
object) – Keyword arguments to pass to the parent constructor.
- render(players, maze, game_state)[source]¶
(This method redefines the method of the parent class with the same name).
This function renders the game to show its current state. It does so by creating a string representing the game state and printing it.
- Parameters:
players (
list[Player]) – Players of the game.maze (
Maze) – Maze of the game.game_state (
GameState) – State of the game.
- Return type:
None