FixedPlayer

This module provides a player that follows a predetermined list of actions. It is used when games are saved and replayed. This player can be useful for testing purposes, for instance to evaluate the behavior of other players against a fixed strategy.

class FixedPlayer.FixedPlayer(actions, *args, **kwargs)[source]

(This class inherits from Player ).

This player follows a predetermined list of actions. This is useful to save and replay a game.

__init__(actions, *args, **kwargs)[source]

Initializes a new instance of the class. The player is given a predetermined list of actions.

Parameters:
  • actions (list[Action]) – List of actions to perform.

  • *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).

Called at each turn of the game to return the next action to perform.

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.