Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CellularAutomataBuilder<T>

Used to create CellularAutomata Maps.

Type parameters

  • T

Hierarchy

  • Builder<T>
    • CellularAutomataBuilder

Index

Constructors

constructor

Methods

clearSnapshots

  • clearSnapshots(): void

connect

  • Connects areas of the map to ensure they are all connected.

    For instance, if you're using an alive value of 1 for walls, then this can connect the dead value of 0 to ensure all squares on the map are accessable.

    Parameters

    • Default value value: T = this.deadValue

      The value to connect (default this.deadValue)

    Returns ConnectData

copyFrom

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

doSimulationStep

  • doSimulationStep(stepCount?: number): void
  • Runs a number of simulation steps. Each step generally "smooths" the map.

    Parameters

    • Default value stepCount: number = 1

      The number of steps to run.

    Returns void

getMap

getSnapshots

  • getSnapshots(): Table<T>[]

randomize

  • randomize(isAliveChance?: number): void
  • Randomly sets each cell to either alive or dead.

    Parameters

    • Default value isAliveChance: number = 0.6

      The chance for a cell to be set to the 'alive' value.

    Returns void

takeSnapshot

  • takeSnapshot(): void

Generated using TypeDoc