Level Model¶
Level¶
Level is the core data structure for a physics puzzle. It bundles objects, action objects, success conditions, and metadata.
Constructor:
from interphyre.level import Level
level = Level(
name="my_level",
objects={"green_ball": green_ball},
action_objects=["red_ball"],
success_condition=success_condition,
metadata={"description": "Goal statement"},
)
Attributes:
name: unique level identifierobjects: mapping of object names toInterphyreObjectinstancesaction_objects: list of object names the agent can placesuccess_condition: callablesuccess_condition(engine) -> boolmetadata: optional dictionary (typically includesdescription)
Methods:
move_object(obj_name, x, y)set_angle(obj_name, angle)change_color(obj_name, color)remove_object(obj_name)set_dynamic(obj_name, dynamic)set_restitution(obj_name, restitution)set_friction(obj_name, friction)clone(new_name=None)