Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DrunkardsWalkBuilder<T>

Generator to perform a Drunkard's Walk

Type parameters

  • T

Hierarchy

Index

Constructors

constructor

Methods

clearSnapshots

  • clearSnapshots(): void

copyFrom

  • copyFrom(table: Table<T>): void

getCoverage

  • getCoverage(): number

getMap

getPaths

getSnapshots

  • getSnapshots(): Table<T>[]

takeSnapshot

  • takeSnapshot(): void

walk

  • walk(config: { maxCoverage?: undefined | number; pathCount?: undefined | number; start?: Vector2; stepsMax: number; stepsMin: number }): Vector2[][]
  • Generate a path by walking a number of steps. Can be called multiple times to have the Drunkard 'jump' to a different spot.

    Parameters

    • config: { maxCoverage?: undefined | number; pathCount?: undefined | number; start?: Vector2; stepsMax: number; stepsMin: number }

      The walk configuration

      • Optional maxCoverage?: undefined | number

        number - Stops walking if this much of the map is explored. Range [0.0, 1.0], default 1.0

      • Optional pathCount?: undefined | number
      • Optional start?: Vector2

        Vector2 - The starting position. Default random.

      • stepsMax: number

        number - The maximum number of steps to take for each walk (exclusive)

      • stepsMin: number

        number - The minimum number of steps to take for each walk (inclusive)

    Returns Vector2[][]

    Vector2[][] - The paths walked

Generated using TypeDoc