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

38 lines 1.69 kB
import Prando from "prando"; import { Maze, NeighbouringCoordinateWithDirection } from "./Maze.js"; import { Coordinate, Direction } from "./types"; export declare class Generator { width: number; height: number; constructor(width: number, height: number); /** * Returns the generated maze from the generation algorithm pass as a parameter. * @param {*} algorithm the algorithm to use to generate the maze * @param {*} prando A prando object constructed with the seed to generate the maze */ generateMaze(algorithm?: string, prando?: Prando): Maze; /** * Generates a maze using the Depth First algorithm * @param {*} prando A prando object constructed with the seed to generate the maze. Used as arandom number generator. */ depthFirst(prando: Prando): Maze; /** * Generates a maze using the Hunt And Kill algorithm * @param {*} prando A prando object constructed with the seed to generate the maze. Used as arandom number generator. */ huntAndKill(prando: Prando): Maze; /** * Get the unvisited neighbours of the current cell * @param {[]} unvisitedNeighbours Generated using maze.getUnvisitedNeigbourIndices */ getValidDirections(unvisitedNeighbours: NeighbouringCoordinateWithDirection[]): Direction[]; /** * Performs a randomised walk from the specified current cell * @param {{x: int, y: int}} currentCell * @param {*} prando Prando random number generator * @param {*} maze A Maze object * @returns A modified maze object */ randomisedWalk(currentCell: Coordinate, prando: Prando, maze: Maze): Maze; } //# sourceMappingURL=Generator.d.ts.map