By default, the agent will be placed on the start cell (the last cell) of the Maze. After importing the agent class, we can create the agent object and we should provide the parent Maze as the first input argument. For that, we have the agent class in the module pyamaze. An agent can be thought of as a physical agent like a robot or it can simply be used to highlight or point a cell in the maze. We can place agent (one or more) inside the Maze. Or we can also provide the value as string as: m.CreateMaze(theme=”light”) To set the theme to light, we can set that as a COLOR class object as: m.CreateMaze(theme=COLOR.light) We have a COLOR class as well inside the pyamze module to manage different colors. The default theme of the Maze is the Dark theme and we can change that to the Light theme by using the argument theme and setting that to the Light theme. While loading a Maze from the CSV file, the size of the Maze while creating the maze does not matter since the information about the size is also loaded from the CSV file. To add or remove one wall from the Maze, we should change two values of the CSV file. With this feature, we can also manually customize the Maze by changing the CSV file. We can later use the CSV file to generate the same old maze by using the loadMaze option and providing the CSV file. 1 means the path is opened in that direction and 0 means it is closed. The CSV file will contain the information of all cells inside the Maze and the information of the opened and closed walls in East West North and South directions. The randomly generated maze will be saved in the working folder as a CSV file. For that, we need to set the optional argument saveMaze to True. There is also the possibility to save any generated maze for future use. from pyamaze import maze m=maze() m.CreateMaze() m.run()Ī random 10x10 maze will be generated like this:
The last statement will be applying the function run to run the simulation. Generate a Maze: To simply generate a maze, you need to create the maze object and then apply the CreateMaze function.
#MAZE PATTERNS FOR HAMSTER MAZE HOW TO#
Here is the detail on how to use the module Or you can visit the GitHub link and copy the module code as Python file named as pyamaze.py
#MAZE PATTERNS FOR HAMSTER MAZE INSTALL#
On command prompt run the following command: pip install pyamaze The detail about the module is presented below and is also explained in this video
This module uses the Tkinter GUI framework which is built-in in Python and you don’t need to install any framework to use this module. By using this module, you don’t need to program the GUI and also you don’t need the Object-Oriented Programming since the module will provide you the support. The main idea of this module, pyamaze, is to assist in creating customizable random mazes and be able to work on that, like applying the search algorithm with much ease.