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:
NoneGridObjectA
NoneGridObjectis the object held by the agent by default if it is not holding any other gym_gridverse.grid_object.GridObject.HiddenA
Hiddenis 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, orlocked. This classmethod return the number of possible states that this GridObject may have.- Return type
- abstract classmethod can_be_represented_in_state()[source]
True iff
state_indexfully represents the grid-object state.GridObjects may have an internal state which is not fully representable by a single integer
state_index, e.g., aBoxcontains a reference to anotherGridObjectas its content. The unfortunate implication is that thisGridObject(and, by extension, any Grido or Environment which contains this type ofGridObject) 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
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
- color
Color of this grid-object
- Return type
- blocks_movement
Whether this grid-object blocks the agent from moving on it
- Return type
- blocks_vision
Whether this grid-object blocks the agent’s vision.
- Return type
- holdable
Whether the agent can pick up this grid-object
- Return type