UNPKG

maze-generation

Version:

A package to generate mazes using the depth first or hunt and kill algorithm. Mazes can be generated with seed values for reproducibility

59 lines 1.84 kB
import type { Direction } from "./types"; type Walls = { left: boolean; right: boolean; up: boolean; down: boolean; }; export type Visited = boolean; export type CellJSONRepresentation = Walls & { visited: Visited; }; /** * A class to represent an individual cell within the maze */ export declare class Cell { walls: Walls; visited: Visited; /** * Creates a cell with all 4 walls. */ constructor(); /** * Removes the wall in the specified direction. * @param {string} direction left;right;up;down. The wall that should be removed. */ removeWall(direction: Direction): void; /** * Returns the fall if the wall exists; returns nothing if the wall does not exist. * @param {string} direction left;right;up;down. The wall that should be removed. * @returns {bool} true if the wall exists; false if the wall does not exist. */ getWallStatus(direction: Direction): boolean; /** * Marks if a cell has been visited or not * @param {bool} visited - The value to set cell.visited to. */ setCellVisited(visited: Visited): void; /** * Returns if the cell has been visited or not * @returns {bool} Returns true if cell has been visited and false if not */ getCellVisited(): Visited; /** * @return {string} a string representation of a cell: * | shows if the right wall exists * _ shows if the down wall exists * e.g.: * * _| would show if all walls exist (if the cell is a top left cell). * * _ would show if the right wall does not exist * * | would show if the down wall does not exist */ toString(): string; /** * Returns the cell as a JSON object */ toJSON(): CellJSONRepresentation; } export {}; //# sourceMappingURL=Cell.d.ts.map