Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
/ maze Public archive
forked from dstromberg2/maze-generator

Random maze generator in Javascript

Notifications You must be signed in to change notification settings

nilfalse/maze

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Maze Generator

A script in JavaScript to create a randomly generated maze.

To use, include the mazegenrator.js file, then call the createMaze(y, x) function with the input parameters for the size of the maze, as x and y variables. Return value is an array defining the new maze.

An example.html file is included to show a possible usage.

GitHub Pages available for demo.

The generated maze is defined by a multidimensional array consisting of y and x coordinates, followed by definitions for the walls of each selected cell. The walls are defined by plain objects with corresponding top, right, bottom and left keys, which define the presence of a wall by boolean value.

Note that y coordinates are used first in the array, and x is second. This is to facilitate the display of the maze in HTML, as horizontal rows need to be established first, followed by each vertical cell in the row.

About

Random maze generator in Javascript

Resources

Stars

Watchers

Forks

Languages

  • JavaScript 67.0%
  • HTML 33.0%