Terminations
check_truncation(terminated, truncated)
Check if the episode is truncated or terminated, and returns a value
that conforms to the StepType
enum.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
terminated |
Array
|
A boolean array indicating whether the episode is terminated. |
required |
truncated |
Array
|
A boolean array indicating whether the episode is truncated. |
required |
Returns:
Name | Type | Description |
---|---|---|
Array |
Array
|
An integer array that represents the step type. |
compose(*term_functions, operator=jnp.any)
Compose termination functions into a single termination function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*term_functions |
Callable
|
List of termination functions. |
()
|
operator |
Callable
|
Operator to combine the termination functions. |
any
|
Returns:
Name | Type | Description |
---|---|---|
Callable |
Callable
|
A single termination function. |
on_ball_hit(prev_state, action, state)
Check if the ball has hit something using the ball_hit
event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prev_state |
State
|
The previous state of the game. |
required |
action |
Array
|
The action taken by the player. |
required |
state |
State
|
The current state of the game. |
required |
Returns:
Name | Type | Description |
---|---|---|
Array |
Array
|
A boolean array indicating whether the ball has hit something. |
on_door_done(prev_state, action, state)
Check if the action done
has been called in front of a Door
object with the correct colour.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prev_state |
State
|
The previous state of the game. |
required |
action |
Array
|
The action taken by the player. |
required |
state |
State
|
The current state of the game. |
required |
Returns:
Name | Type | Description |
---|---|---|
Array |
Array
|
A boolean array indicating whether the action |
on_goal_reached(prev_state, action, state)
Check if the goal has been reached using the goal_reached
event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prev_state |
State
|
The previous state of the game. |
required |
action |
Array
|
The action taken by the player. |
required |
state |
State
|
The current state of the game. |
required |
Returns:
Name | Type | Description |
---|---|---|
Array |
Array
|
A boolean array indicating whether the goal has been reached. |
on_lava_fall(prev_state, action, state)
Check if the lava has fallen using the lava_fall
event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prev_state |
State
|
The previous state of the game. |
required |
action |
Array
|
The action taken by the player. |
required |
state |
State
|
The current state of the game. |
required |
Returns:
Name | Type | Description |
---|---|---|
Array |
Array
|
A boolean array indicating whether the lava has fallen. |