Skip to content

Go to object

GoToObject (issue #173): a single room scattered with n_objects Key/Ball/Box instances of distinct colours; one is chosen as the per-episode target via State.mission (same pattern GoToDoor already uses). Success requires calling done while facing the target (verified against MiniGrid's actual GoToObjectEnv.step - not just proximity, and calling toggle at all immediately fails), unlike the already-shipped GoToDoor/events.on_door_done, which doesn't check the action at all (a pre-existing gap, left as-is here - see PR description).

Each object's type is drawn independently (matching MiniGrid's own types = ["key", "ball", "box"] sampled per object, checked directly against source - not a fixed split), so the actual per-type counts vary by episode; implemented by always allocating n_objects Key/Ball/Box slots and pushing every slot not assigned that episode's type to DISCARD_PILE_COORDS - the same padding-sentinel pattern LavaCrossing already uses for its own variable-count entities.

Registers with transitions_fn=transitions.deterministic_transition, overriding the default stochastic_transition - the latter unconditionally moves every Ball entity a random step each turn (transitions.update_balls, meant for DynamicObstacles), which would silently walk this environment's target/decoy objects around the room turn by turn. Real MiniGrid's Ball is static outside DynamicObstacles (confirmed empirically: without this override, mission.position stops matching any object's actual position after just a couple of steps).

Bases: Environment

Navix-GoToObject-*. A room scattered with n_objects coloured Key/Ball/Box objects of distinct colours; one is named in State.mission. The agent succeeds by signalling done while orthogonally adjacent to the target (using toggle fails outright). Each object's type is drawn independently per episode. Uses deterministic_transition so balls stay put.

Attributes:

Name Type Description
n_objects int

how many objects to scatter.