Skip to content

Freeway-MinAtar

MinFreeway

MinFreeway(use_minimal_action_set: bool = True)

Bases: Environment[EnvState, EnvParams]

Guide a chicken across a freeway with eight lanes of traffic.

JAX port of the MinAtar Freeway environment. The chicken starts in the bottom row of a 10x10 grid and can travel up and down in column 4, moving at most once every params.player_speed steps (3 by default). Eight cars, one in each of the rows 1 to 8, travel horizontally and teleport to the other side at the edge. Each car has a random direction and a random speed s between 1 and 5, with which it moves one cell every s + 1 steps. When the chicken is hit by a car, it is returned to the bottom row. Each time it reaches the top row, it is returned to the bottom row and the car speeds and directions are randomized.

  • Observation: Box of shape (10, 10, 7) with binary channels: 0 chicken, 1 car, 2 to 6 trail. The cell behind a car with speed s is set in channel s + 1, so the trail indicates both the direction and the speed of the car.
  • Actions: Discrete(3) with the minimal action set: 0 no-op, 1 up, 2 down. Discrete(6) with the full action set: 0 no-op, 2 up, 4 down; the actions 1, 3 and 5 have no effect.
  • Reward: +1 each time the chicken reaches the top row.
  • Termination: never; episodes only end by truncation.
  • Truncation: after params.max_steps_in_episode steps (2500 by default).

Parameters:

  • use_minimal_action_set (bool, default: True ) –

    Whether to expose only the actions that have an effect in this game instead of all six MinAtar actions.

References

Parameters and state

EnvParams

Bases: EnvParams

Parameters of the Freeway environment.

Attributes:

  • player_speed (int) –

    Number of steps between two moves of the chicken.

  • max_steps_in_episode (int) –

    Number of steps after which the episode is truncated.

EnvState

Bases: EnvState

State of the Freeway environment.

Attributes:

  • pos (int) –

    Row of the chicken; its column is fixed at 4.

  • cars (Array) –

    Array of shape (8, 4) with one car for each of the rows 1 to 8. Columns are [x, y, timer, speed]: timer counts the steps left until the car moves next and the sign of speed is its direction (positive moves right). A car moves one cell every abs(speed) + 1 steps.

  • move_timer (int) –

    Steps left until the chicken can move again.

  • time (int) –

    Number of steps taken in the current episode.

  • terminal (bool) –

    Whether the episode has terminated; always False in Freeway.