Options
All
• Public
• Public/Protected
• All

# Interface Map<T>

• 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

• 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

#### Returns void

• get(x: number, y: number): T
• Get the value at position X,Y

#### Returns 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
• Set the value of X,Y to `value`

#### Returns 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.

#### Returns void

Generated using TypeDoc