Random Maze Generator

Summary: This program generates a maze using a given width, height, position of the starting point, and the position of the ending point.

Description: A browser-based maze generator that creates random perfect mazes (connected, acyclic graphs) on an HTML5 canvas. The user specifies grid dimensions and start/end coordinates, then the generator builds a maze by repeatedly adding walls-removed connections while avoiding cycles until every cell is reachable from the start. The generated maze is drawn on a canvas with the start cell highlighted green and the end cell highlighted red. Basic statistics (wall count, estimated minimum wall count, dead ends) are displayed beneath the canvas.

Dates: 3/27/2024 – 7/15/2024

Languages: HTML and JavaScript

Skills:

  • Functions
  • innerHTML
  • Arrays
  • Drawing on canvas
  • HTML forms
  • HTML input
  • Depth-first search
  • Random integers
  • Getting values in a form

File:

How to Run:

  1. Open index.html in a modern browser
  2. Enter the width (columns) and height (rows) of the maze.
  3. Enter start and end coordinates/positions (zero-indexed).
  4. Click the Generate button to build and render the maze on the canvas.

Repository: https://github.com/marvel3492/random-maze-generator