Class: SquareGrid

grids.SquareGrid

Hierarchy

Implements

Constructors

constructor

new SquareGrid(width, height, walls?): SquareGrid

Parameters

Name Type Default value
width number undefined
height number undefined
walls GridLocation[] []

Returns

SquareGrid

Properties

height

Readonly height: number


walls

Private walls: Record<string, true>


width

Readonly width: number

Methods

inBounds

inBounds(id): boolean

Parameters

Name Type
id GridLocation

Returns

boolean


neighbors

neighbors(id): GridLocation[]

Returns the set of direct connections reachable from a location.

Parameters

Name Type Description
id GridLocation The location to check for connections from

Returns

GridLocation[]

Implementation of

Graph.neighbors


passable

passable(id): boolean

Parameters

Name Type
id GridLocation

Returns

boolean