Dayan-Zhanchi / Maze-generator

Maze generation implemented with different algorithms and visualized with pygame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maze-generation

Maze generation using different maze algorithms. Additionally, some pathfinders was also implemented. Thus far it's only working with mazes that was genereted with recursive backtracking. The start point is always at the upper left corner and the end point is at the lower right corner.

Pygame was used to visualize the maze generation and the pathfinding process.

List of maze algorithms

  • Recursive backtracking
  • Prims
  • Hunt and kill
  • Kruskal
  • Binary tree
  • Growing tree

List of pathfinders

  • Recursive backtracking
  • A* search

How to run

Download the packages in the requirements file:

pip install -r requirements.txt

To start the screen run the following command:

py main.py

When the screen appears with a 2D grid, press either button to start the maze generation. To generate a new maze simply click either buttons again when the current generation has finished. The different buttons represent the different algorithms.

Commands

You can also use commands to start the generation or exit the screen. The only way to start pathfinder is with commands.

Command Description
p Run Prims algorithm
r Run Recursive backtracking
h Run Hunt and kill
b Run Binary tree
g Run Growing tree
k Run Kruskal
1 Run A* star search
2 Run Recursive backtracking
esc Exit

Visualizations

Maze generations

Recursive backtracking

Maze generation visualization RB

Prims

Maze generation visualization Prims

Hunt and kill

Maze generation visualization hunt and kill

Binary tree

Maze generation visualization binary tree

Growing tree

Maze generation visualization growing tree

Kruskal

Maze generation visualization kruskal

Pathfinders

Recursive backtracking

Maze pathfinder visualization RB

A star search

Maze pathfinder visualization A*

About

Maze generation implemented with different algorithms and visualized with pygame


Languages

Language:Python 100.0%