Random1¶
This module provides a player that performs random actions in a PyRat game. It is a simple player that does not take into account the maze structure.
- class Random1.Random1(*args, **kwargs)[source]¶
(This class inherits from
Player).This player controls a PyRat character by performing random actions. More precisely, at each turn, a random choice among all possible actions is selected. Note that this doesn’t take into account the structure of the maze.
- __init__(*args, **kwargs)[source]¶
Initializes a new instance of the class. Here, the constructor is only used to initialize the player. It transmits the arguments to the parent constructor, which is responsible for initializing the name and the skin of the player.
- Parameters:
args (
object) – Arguments to pass to the parent constructor.kwargs (
object) – Keyword arguments to pass to the parent constructor.
- turn(maze, game_state)[source]¶
(This method redefines the method of the parent class with the same name).
It is called at each turn of the game. It returns an action to perform among the possible actions, defined in the
Actionenumeration.- Parameters:
maze (
Maze) – An object representing the maze in which the player plays.game_state (
GameState) – An object representing the state of the game.
- Return type:
Action- Returns:
One of the possible actions.