Constructor
# new GridWorldGame(sizeopt, randomSeednullable)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
size |
number
|
<optional> |
10 | The dimensions of the grid. |
randomSeed |
number
|
<nullable> |
The random seed. |
Members
Map.<GridWorldActionKeys, GridWorldAction>
# static actionMapping
The action string to action mapping
# static getActionSpace
Get the action space.
Methods
# getStartingPosition(size) → {Vec2}
Get a starting position.
Parameters:
Name | Type | Description |
---|---|---|
size |
the size of the grid. |
The starting position.
# player() → {GridWorldPlayer}
Get the player.
# state() → {GridWorldState}
Get the current environment state
# step(actionString) → {StepResult.<GridWorldState>}
Play an environment step.
Parameters:
Name | Type | Description |
---|---|---|
actionString |
GridWorldActionKey
|
The action to take. |
The result of the action.
# static encodeStateToIndices(state) → {Array.<number>}
Encode a state to a numbers array
Parameters:
Name | Type | Description |
---|---|---|
state |
GridWorldState
|
The state to encode. |
The encoded numbers array.
Array.<number>