robot_game#

Classes#

class prt_sim.jhu.robot_game.RobotGame(render_mode: str | None = 'rgb_array')[source]#

Robot Game is a discrete grid world navigated by Fred the robot.

Robot Game

Action space: integer representing a discrete action described in the table below

Num

Action

0

up

1

down

2

left

3

right

Observation space: integer representing the current grid space

Reward: +25 for reaching goal, -25 for falling in pit, -1 for every other location

Examples:

execute_action(action: int) Tuple[int, float, bool][source]#

Executes the action and a step of the world.

Parameters:

action (int) – robot action to take

Returns:

a tuple of the (state, reward, done)

Return type:

tuple

get_number_of_actions() int[source]#

Returns the number of actions in the world.

Returns:

number of actions

Return type:

int

get_number_of_states() int[source]#

Returns the number of states in the world.

Returns:

number of states

Return type:

int

get_state() int[source]#

Returns the current world state, which is the location of the robot.

Returns:

current location of the robot

Return type:

int

render()[source]#

Renders the environment

reset(seed: int | None = None, randomize_start: bool | None = False) int[source]#

Resets the world to initial state. If initial_state is None, the robot is initialized to state 8.

Parameters:
  • seed (int, optional) – Random seed. Defaults to None.

  • randomize_start (bool, optional) – Whether to randomize the starting state. Not all environments will support this. Defaults to False.

Returns:

current state value

Return type:

int