GridObject#

A GridObject represents an object in the gridworld, its properties, and (partially) its behavior. A GridObject defines certain methods and attributes, which are used to influence its representation and behavior.

Note

There are two special grid-objects meant for special occasions:

NoneGridObject

A NoneGridObject is the object held by the agent by default if it is not holding any other gym_gridverse.grid_object.GridObject.

Hidden

A Hidden is the grid-object used to indicate a non-observable

Class Methods#

A GridObject class provides the following class methods:

class GridObject(*args, **kwargs)[source]

Represents the contents of a grid cell

abstract classmethod num_states()[source]

Number of internal states.

GridObjects themselves can have internal states, e.g., a Door may be open, closed, or locked. This classmethod return the number of possible states that this GridObject may have.

Return type

int

abstract classmethod can_be_represented_in_state()[source]

True iff state_index fully represents the grid-object state.

GridObjects may have an internal state which is not fully representable by a single integer state_index, e.g., a Box contains a reference to another GridObject as its content. The unfortunate implication is that this GridObject (and, by extension, any Grido or Environment which contains this type of GridObject) cannot produce a truly fully observable State representation, which becomes disallowed. However, the GridObject, Grid, and Environment may still be used to represent partially observable control tasks.

Return type

bool

Attributes#

A GridObject has the following attributes:

class GridObject(*args, **kwargs)[source]

Represents the contents of a grid cell

state_index

State index of this grid-object

Return type

int

color

Color of this grid-object

Return type

Color

blocks_movement

Whether this grid-object blocks the agent from moving on it

Return type

bool

blocks_vision

Whether this grid-object blocks the agent’s vision.

Return type

bool

holdable

Whether the agent can pick up this grid-object

Return type

bool