Skip to content

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

  1. In the World Builder, tick Evaluation in the sidebar, then click Edit.
  2. 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.
  3. Below it, write the grading script (Python). It must define def evaluate(sim), called on every observation; report with sim.record(value) and end the run with sim.finish(). An optional def initialize(sim) runs once at the start.
  4. 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.

AI