MazeFromMatrix

This module provides a maze that is created from a fixed description as a numpy.ndarray or a torch.tensor. Indices of rows and columns are the indices of the corresponding cells. This class is especially useful to allow exporting a maze to a file, and then reusing it later. It is also useful to test a player on a fixed maze.

class MazeFromMatrix.MazeFromMatrix(description, *args, **kwargs)[source]

(This class inherits from Maze ).

This is a maze that is created from a fixed description as a numpy ndarray or a torch tensor. Indices of rows and columns are the indices of the corresponding cells. Entries are the weights of the corresponding edges. Rows and columns with only 0 values will be ignored. This class can be useful to test a player on a fixed maze, to compare its performance with other players.

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

Initializes a new instance of the class.

Parameters:
  • description (object) – Fixed maze as a matrix (not specified for optional dependency reasons).

  • *args (object) – Arguments to pass to the parent constructor.

  • **kwargs (object) – Keyword arguments to pass to the parent constructor.