Class: SquareGrid
grids.SquareGrid
Hierarchy
-
SquareGrid
Implements
Constructors
constructor
• new SquareGrid(width
, height
, walls?
): SquareGrid
Parameters
Name | Type | Default value |
---|---|---|
width |
number |
undefined |
height |
number |
undefined |
walls |
GridLocation [] |
[] |
Returns
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
Implementation of
passable
▸ passable(id
): boolean
Parameters
Name | Type |
---|---|
id |
GridLocation |
Returns
boolean