Interface Map<T>

Type Parameters

  • T

Hierarchy

  • Map

Properties

map: T[][]

The underlying map. Be warned this map maybe shifted so that 0 = minX etc...

maxX: number

The maximum X value of the map

maxY: number

The maximum Y value of the map

minX: number

The minimum X value of the map

minY: number

The minimum Y value of the map

Methods

  • Run the given itterator for every cell in the map

    Parameters

    • itterator: ((x: number, y: number, value: T) => void)

      A function that is passed the x/y coords and the current value.

        • (x: number, y: number, value: T): void
        • Parameters

          • x: number
          • y: number
          • value: T

          Returns void

    Returns void

  • Get the value at position X,Y

    Parameters

    • x: number
    • y: number

    Returns T

  • Find the valid neighbours for the given position.

    Parameters

    • x: number

      The X coord

    • y: number

      The Y coord

    • Optional diagonals: boolean

      Include diagonals in the list?

    Returns {
        x: number;
        y: number;
    }[]

  • Set the value of X,Y to value

    Parameters

    • x: number
    • y: number
    • value: T

    Returns void

  • Set all the cells in the range to value or pass a function that takes the current value as its only argument and returns a new value.

    Parameters

    • minX: number
    • maxX: number
    • minY: number
    • maxY: number
    • value: T | ((current: T) => T)

    Returns void

Generated using TypeDoc