Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/semibran/maze
:corn: flexible perfect maze generator
https://github.com/semibran/maze
game generator maze perfect
Last synced: 9 days ago
JSON representation
:corn: flexible perfect maze generator
- Host: GitHub
- URL: https://github.com/semibran/maze
- Owner: semibran
- License: mit
- Created: 2017-05-09T23:16:56.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-06T22:09:16.000Z (over 7 years ago)
- Last Synced: 2024-04-29T09:41:11.240Z (6 months ago)
- Topics: game, generator, maze, perfect
- Language: JavaScript
- Homepage:
- Size: 32.2 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# maze
> Flexible perfect maze generatorThis module generates "perfect mazes" (i.e. no loops) by connecting "nodes" from a given list.
![Isometric maze](maze.png "Spunky rendering engine not included.")
Note that a "node" does not necessarily have to be a regular grid cell - it can be of any shape or size!
## install
```sh
npm install maze
```## usage
See [`test.js`](https://github.com/semibran/maze/blob/master/test.js) for an extensive example. You could also clone this repository and run the script locally if you'd like to run the maze generator on your machine.### `maze = generate(nodes, adjacent, choose)`
Maps each node in `nodes` to a list of connections and stores the resulting `Map` in `maze`.- `nodes`: A list of nodes to connect
- `adjacent`: A function of the form `adjacent(a, b)` which determines if node `a` and node `b` can be connected
- `choose`: A function of the form `choose(array)` which chooses a random item from `array`## license
[MIT](https://opensource.org/licenses/MIT) © [Brandon Semilla](https://git.io/semibran)