Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Map<T>

Type parameters

  • T

Hierarchy

  • Map

Index

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

  • forEach(itterator: (x: number, y: number, value: T) => void): void
  • 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(x: number, y: number): T
  • neighbours(x: number, y: number, diagonals?: boolean): { x: number; y: number }[]
  • 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(x: number, y: number, value: T): void
  • setRange(minX: number, maxX: number, minY: number, maxY: number, value: T | ((current: T) => T)): 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