originshift

1.0.0 • Public • Published

Origin Shift

npm Author

Origin Shift is a package that implements a maze generator algorithm inspired by CaptainLuma.

Prerequisites

Before using Origin Shift, ensure you have the following:

Installation

To install Origin Shift using npm, run:

npm install originshift --save

Advantages

  1. Guaranteed Paths: There is always a path from every point to any other.
  2. Dynamic Mazes: The maze can change dynamically, allowing you to interact with it in real-time.

Disadvantages

  1. Initial Configuration: The maze may require multiple steps to achieve a complex structure.

Constructor

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.

Methods

  1. step(): Advances the maze by one step, modifying its layout.
  2. generate(iterations): Advances the maze by a specified number of steps in one call.
  3. getArray(): Returns an array representation of the maze:
    • -1 => Origin
    • 0 => Up
    • 1 => Right
    • 2 => Down
    • 3 => Left

Examples

const Maze = require('originshift');
let maze = new Maze(10); // Creates a 10x10 maze

console.log(maze.getArray()); // Displays the array representation of the maze

Dependencies (3)

Dev Dependencies (1)

Package Sidebar

Install

npm i originshift

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

7.44 kB

Total Files

5

Last publish

Collaborators

  • seyronh