Origin Shift is a package that implements a maze generator algorithm inspired by CaptainLuma.
Before using Origin Shift, ensure you have the following:
- Node.js installed.
To install Origin Shift using npm, run:
npm install originshift --save
- Guaranteed Paths: There is always a path from every point to any other.
- Dynamic Mazes: The maze can change dynamically, allowing you to interact with it in real-time.
- Initial Configuration: The maze may require multiple steps to achieve a complex structure.
The constructor takes one argument: the size of the maze (Size x Size). It initializes the maze with 5 * size steps, creating a simple starting configuration.
- step(): Advances the maze by one step, modifying its layout.
- generate(iterations): Advances the maze by a specified number of steps in one call.
-
getArray(): Returns an array representation of the maze:
- -1 => Origin
- 0 => Up
- 1 => Right
- 2 => Down
- 3 => Left
const Maze = require('originshift');
let maze = new Maze(10); // Creates a 10x10 maze
console.log(maze.getArray()); // Displays the array representation of the maze