Constructor
# new TaxiGame(randomSeednullable)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
randomSeed |
number
|
<nullable> |
the random seed |
Members
Methods
# customer() → {TaxiCustomer}
Get the customer
# gameState() → {TaxiGameState}
Get the games current state
# player() → {TaxiPlayer}
get the player
# reset(resetGameStateopt, initialGameStatenullable) → {boolean}
Reset the game
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
resetGameState |
boolean
|
<optional> |
true | Whether to reset the games state |
initialGameState |
TaxiGameState
|
<nullable> |
The initial game state |
Whether the reset was successful
boolean
# step(actionString) → {StepResult}
Perform a single game step
Parameters:
Name | Type | Description |
---|---|---|
actionString |
TaxiActionKey
|
The action to perform. |
The result of the step
# updatePlayerPosition(action) → {StepResult}
Update the player position with the taken action
Parameters:
Name | Type | Description |
---|---|---|
action |
TaxiAction
|
the taken action |
The result of the steps
# updatePoints(points) → {void}
Update the number of points
Parameters:
Name | Type | Description |
---|---|---|
points |
number
|
The points to add / subtract |
void
# static encodeStateToIndices(state) → {Array.<number>}
encode the game state to an encoded numbers array
Parameters:
Name | Type | Description |
---|---|---|
state |
TaxiGameState
|
the state to encode |
The encoded array
Array.<number>