Skip to main content

miniworlds-robot

miniworlds-robot is a small extension library for miniworlds. It provides robot worlds with a restricted, configuration-driven API for learners.

The library builds everything from miniworlds worlds and actors. It does not load pygame sprites or expose pygame primitives.

The package is intentionally kept separate from the miniworlds core package so it can later live in its own repository and be published on PyPI.

Robot abilities

Each world activates a subset of the robot API via robot_abilities. A robot only exposes methods that are enabled in its world; calling anything else raises a clear AttributeError.

Ability Method Description
step robot.step() Move one tile forward if the destination is free
turn_left robot.turn_left() Rotate 90° counter-clockwise
turn_right robot.turn_right() Rotate 90° clockwise
on_leaf robot.on_leaf() True if the robot shares its tile with a leaf
remove_leaf robot.remove_leaf() Remove a leaf on the robot's tile; returns bool
can_move robot.can_move() True if the next step() would succeed
position robot.position Current tile as (column, row)

can_move lets learners write conditional loops without peeking into the robot's internals:

while robot.can_move():
    robot.step()

Example

from miniworlds_robot import load

world, robot = load("basic", position=(1, 1))

robot.step()
robot.turn_left()

print(world.is_solved())
world.run()

Worlds can also be loaded from JSON URLs, including GitHub blob links:

from miniworlds_robot import load

world, robot = load(
    "https://github.com/asbl/miniworlds-robot-worlds/blob/main/worlds/01-sequences/sequence_01_straight_line.json"
)

Metadata

Release files for miniworlds-robot 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for miniworlds-robot 0.1.5
File Size Uploaded
miniworlds_robot-0.1.5.tar.gz 25.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for miniworlds-robot 0.1.5
File Interpreter ABI Platform
miniworlds_robot-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 52.3 kB

Release files / miniworlds_robot-0.1.5.tar.gz

Download URL miniworlds_robot-0.1.5.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
585bf7ce3aef3bfdec410848126d0ef4a2225533b28b701eb3f0292e04c51ea8
BLAKE2b-256 checksum
How to use checksums
cae7103958251f09db5c7a204547add6f9a3657b3fbde2683b85a1c6489b907d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / miniworlds_robot-0.1.5-py3-none-any.whl

Download URL miniworlds_robot-0.1.5-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0da2162240f697708bd0ff2fcd89c1c2818323283536e76ef3f4ede1018ede3c
BLAKE2b-256 checksum
How to use checksums
0a23c2c933af560ee12a2ddf3d6f63088242f3b0c587a898dc66fd0f8eae0f09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page