maze_generator_v2.py

Created by gradient01

Created on July 27, 2026

6.05 KB

This is a random maze generator that uses depth-first search algorithm. You can change its size by modifying the “size” variable in the “main.py” script. Generating the size 2 maze takes about 15 seconds. After generation, the script will find the two furthest points and place the start and finish at these locations. After that, you can solve it! Once you have found the exit, the solution will be calculated and displayed.

You can also check out maze_generator_v1, which uses Kruskal’s algorithm.

Good luck!


During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.