Transitions
Transition functions: given (state, action, action_set), produce the
next State.
An Environment's transitions_fn is one of these. They all start by
applying the agent's action (action_set[action], a state -> state
primitive - see navix.actions) and then optionally advance any
autonomous entities. DEFAULT_TRANSITION is stochastic_transition.
DEFAULT_TRANSITION = stochastic_transition
module-attribute
The transitions_fn an Environment uses unless overridden:
stochastic_transition (agent action + random ball motion).
deterministic_transition(state, action, actions_set)
Applies only the agent's action - nothing else in the world moves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
the current state, $s_t$. |
required |
action
|
Array
|
a scalar integer action, |
required |
actions_set
|
tuple[Callable, ...]
|
the environment's
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
State |
State
|
$s_{t+1}$. |
stochastic_transition(state, action, actions_set)
Applies the agent's action, then moves every Ball one random
step (update_balls). This is DEFAULT_TRANSITION - environments
without balls behave identically to deterministic_transition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
the current state, $s_t$. |
required |
action
|
Array
|
a scalar integer action, |
required |
actions_set
|
tuple[Callable, ...]
|
the environment's
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
State |
State
|
$s_{t+1}$, with balls advanced. |
update_balls(state)
Moves every Ball one cell in a uniformly random direction, or
leaves it in place if that cell is blocked. A ball that would move
onto the player instead stays put and records a
(BALL, HIT) event (used by rewards.on_ball_hit /
terminations.on_ball_hit).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
the current state. If it has no |
required |
Returns:
| Name | Type | Description |
|---|---|---|
State |
State
|
the state with ball positions and ball-hit events |
State
|
updated, and |