Add an evaluation to your world¶
An evaluation makes your world gradeable: students press Start, drive, and get a record — lap time, points, anything your script measures.
Set it up¶
- In the World Builder, tick Evaluation in the sidebar, then click Edit.
- Fill in the form: the description (shown to students before they start), whether lower or higher records are better, and the time limit. Students enter the command that starts their own code (and an optional cleanup command) when they start.
- Below it, write the grading script (Python). It must define
def evaluate(sim), called on every observation; report withsim.record(value)and end the run withsim.finish(). An optionaldef initialize(sim)runs once at the start. - Save, and save the world.
Writing the script¶
The script sees sim.state (time, pause state, real-time factor, car pose with roll/pitch, objects, traffic
lights, brightness, the student's program, the sounds the robot plays — with their bytes), sim.track
(with its bounds), sim.objects (the object catalog) and sim.origins, and can act with sim.teleport,
sim.move_object, sim.set_light, sim.overlay, sim.set_brightness and sim.pause. Laps, collisions and penalties are
computed by the script itself — the default template shows how. More on the
World Builder page. Two tips:
- Start from the simplest metric (elapsed time to the finish line) and grow.
- The site's AI assistant can draft the script with you, right on the World Builder page — describe the rules of your competition and iterate.
Use it¶
Publish the world (next page) — students who load it see your description and a Start button; records come back comparable because everyone runs the same script, the same time limit, the same robot.