Class WangTileChunk<D, V>

A chunk is a block of the dimension which can be used to observe part of a tile generated world.

Type Parameters

Constructors

Properties

observed: boolean = false
coordMap: CoordMap<D, V>
center: D
iter: number
active: null | D = null
tileset: Set<WangTile<D, unknown>>

Methods

  • Convert coordinate map to a simple object for storage and testing.

    Returns Record<string, V>

    An object representing all coordinates in the map. Keys are comma delineated coordinates.

  • Convert coordinate map to an ascii representation. Only works for 2D chunks at the moment.

    Returns string

    An ascii based representation of the map.

  • Get the number for possibilities for a coordinate via count.

    Parameters

    • coord: D

      The coordinate to calculate.

    Returns number

    the count of possibilities for a coordinate.

  • Reduce a tileset by a neighboring tile.

    Parameters

    • tile: WangTile<D, unknown>

      The neighboring tile

    • availableTiles: WangTileSet<D, unknown>

      The tileset to reduce

    • dimensions: number

      The number of dimensions

    • dimension: number

      The dimension of the edge

    • offset: -1 | 1

      The offset from the position

    Returns WangTileSet<D, unknown>

    • A new tileset reduced by the neighboring tile.
  • Reduce a tileset by a neighboring tile.

    Parameters

    • tiles: WangTileSet<D, unknown>

      The neighboring tileset

    • availableTiles: WangTileSet<D, unknown>

      The tileset to reduce

    • dimensions: number

      The number of dimensions

    • dimension: number

      The dimension of the edge

    • offset: -1 | 1

      The offset from the position

    Returns WangTileSet<D, unknown>

    • A new tileset reduced by the neighboring tile.