PyRasp

Workspace tour

The workspace is where every build happens: the daily problem, practice and the sandbox all use the same layout. There are three columns: the task and shop on the left, the two file editors in the middle, and the board with the console on the right.

The sidebar tabs

  • Task — the problem: its statement, its budget and its par (our reference build's cost and a target time). At the bottom, The test checks lists exactly what the tests will verify. This tab only exists when a task is open.
  • Shop — every part and kit, with its price, a one-line example of how to use it in circuit.py, and an Add to circuit.py button that appends that line for you. The top of the tab shows your bill and a meter against the budget; a build over budget fails its tests as Over budget without running the program.
  • Guide — the shortest possible reminder of how circuit.py and the Run buttons work, with links into these docs. This is the tab the sandbox opens on.
  • Results — the result of the last Run tests, one line per check with the reason for any failure, the build's cost, and what the program printed. Once every check passes, it also compares your cost with par.

The two editors

The middle column has two files, switched with the circuit.py and main.py tabs:

  • circuit.py buys the parts and wires the board. It is built when you press Run or Run tests, and quietly a moment after you stop typing, so the board, the bill and the schematic keep up with your edits (errors only show on Run or Run tests). The board view and the bill follow the last build, and the small chip next to the tabs tells you when a build is running, how many parts are on the board, that you have edited since the last run, or that circuit.py has an error. A build error shows its message, the line in circuit.py, and the full traceback under the editor.
  • main.py is the program that runs when the board is powered. Nothing in it happens until you press Run.

Both files are saved in your browser for that task, so reloading the page, or closing it and coming back, does not lose your work.

The board

The right-hand panel is a live picture of circuit.py: the Pi, the parts, and the wires between them. It is deliberately read-only — the simulator lays the board out for you: the Pi sits at the bottom with its GPIO header along the top edge, parts wired to the Pi sit in a row just above the header pins they use, parts wired only to those parts go in the row above, a module or kit stays together, and wires run in straight horizontal and vertical lines. Use at= on a part to place it yourself. The ⤢ button fits the board to the panel, and ⚡ shows the current in the wires as little blue whirls travelling along them (see Seeing the current). The Board | Schematic switch above it shows the same circuit as a schematic diagram, with standard symbols (a zigzag resistor, an LED's triangle) and part names such as R1 and D1; Building it on a real Pi explains how to read it. The very first time you open a workspace, the board panel shows Python booting instead: the browser downloads about 13 MB once, with a progress bar, and keeps it cached afterwards. You can read the task and type while it loads. If something is wired wrong, the board or the build error will say so; overcurrent warnings appear over the board.

To place and wire parts by hand, or to probe the board with instruments, open the Lab tab (or Lab mode in the sandbox toolbar): Lab mode is the full simulator.

The console

Under the board is the console: everything main.py prints, plus its errors. If the program calls input(), the console waits for you — type a line and press Enter, and the program continues.

The buttons

In the toolbar, from left to right:

  • Run / ■ Stop — powers the board on and runs main.py, or ends the run. Parts you can press (buttons, switches, keys) still respond to clicks while running.
  • Export — downloads a zip to build it on a real Pi: your code, a wiring sheet with a shopping list, a schematic, setup steps and a picture of the board. See Building it on a real Pi.
  • Run tests — only when a task is open. It runs the judge in your browser against the task's checks, and reports in the Results tab: start Python, build, simulate (with a progress bar for the simulated seconds) and check. The next run's Python is started in the background, so a second run starts almost at once. It is safe to run as often as you like: the first time every check passes, the problem is solved.

Before them, in the sandbox only, New… starts over with a fresh starter on a Raspberry Pi or a Pico, and Lab mode opens the full simulator. The header also shows your current bill against the budget.

Going deeper

  • There is no clock and no submission. Run tests is the whole judge: it runs here, it is deterministic, and a pass is what counts. See how a run works.
  • Files are kept per task: each day's daily problem, each practice problem and the sandbox store their own pair of files in this browser.
  • Lab mode is different in kind: there you edit the board itself, with the inspector, data feeds and instruments, instead of writing circuit.py. See Lab mode.