Skip to content

Catch-bsuite

Catch

Catch(rows: int = 10, columns: int = 5)

Bases: Environment[EnvState, EnvParams]

Catch a falling ball by moving a paddle along the bottom row of a grid.

JAX port of the bsuite Catch environment. The ball starts in a uniformly random column of row 0 and falls one row per step. The paddle starts in column columns // 2 of the last row.

  • Observation: Box of shape (rows, columns) that is 0 everywhere except for a 1 at the ball position and a 1 at the paddle position.
  • Actions: Discrete(3). 0 moves the paddle one column to the left, 1 keeps it in place and 2 moves it one column to the right. The paddle stays within the grid.
  • Reward: on the step in which the ball reaches the last row, 1 if the paddle is in the ball's column and -1 otherwise. 0 on all other steps.
  • Termination: the ball reaches the last row, which takes rows - 1 steps.
  • Truncation: after params.max_steps_in_episode steps (1000 by default).

Parameters:

  • rows (int, default: 10 ) –

    Number of rows of the grid.

  • columns (int, default: 5 ) –

    Number of columns of the grid.

References

Parameters and state

EnvParams

Bases: EnvParams

Parameters of the Catch environment.

Attributes:

  • max_steps_in_episode (int) –

    Number of steps after which the episode is truncated.

EnvState

Bases: EnvState

State of the Catch environment.

Attributes:

  • ball_x (Array) –

    Column of the ball.

  • ball_y (Array) –

    Row of the ball. Starts at 0 and increases by one every step.

  • paddle_x (int) –

    Column of the paddle.

  • paddle_y (int) –

    Row of the paddle, always rows - 1.

  • prev_done (bool) –

    Whether the ball reached the paddle row in the previous step. If set, step_env starts from a freshly sampled initial state instead of moving the ball and the paddle.

  • time (int) –

    Number of steps taken in the current episode.