{"task_id": "gcode-toolpath-parity", "title": "G-code toolpath parity", "domain": "CNC machining", "summary": "Reproduce the exact tool path of the LinuxCNC 2.9.4 rs274 interpreter in standard-library Python, cutter compensation and canned cycles included.", "deliverable": "simulate(program, setup)", "path": "gcode-toolpath-parity", "instruction": "Our web program checker must predict the exact tool-center path a LinuxCNC 2.9 mill will run, to check fixture clearance, on a server without LinuxCNC. Write `/app/toolpath.py`, standard library only, exposing `simulate(program: str, setup: dict) -> dict`. Ground truth is the `rs274` standalone interpreter from Debian's `linuxcnc-uspace` package, version `1:2.9.4-2+deb13u1`, installed here: `python3 /app/data/probe/run_probe.py ` runs it with our metric machine configuration and prints its canonical calls; add `--number` to tag each line with its line number so a failing block shows which line it is.\n\n`setup` is `{\"tools\": {\"\": {\"diameter\": mm, \"length\": mm}}, \"work_offsets\": {\"G54\": [x, y, z], ..., \"G59\": [...]}, \"g28_position\": [x, y, z], \"g30_position\": [x, y, z]}`, all machine coordinates in mm. The program starts at machine zero with no tool loaded, in LinuxCNC's power-on modal state.\n\nReturn `{\"moves\": [...], \"error\": null}`. `moves` lists every motion and dwell the interpreter commands, in order, including zero-length motions and inserted corner arcs:\n\n- `{\"type\": \"rapid\", \"to\": [x, y, z]}` for a straight traverse\n- `{\"type\": \"feed\", \"to\": [x, y, z], \"feed\": f}` for a straight feed\n- `{\"type\": \"arc\", \"to\": [x, y, z], \"plane\": \"XY\"|\"XZ\"|\"YZ\", \"center\": [a, b], \"turns\": n, \"feed\": f}`, where `center` holds the plane's two axes in that order (XY: x, y; XZ: x, z; YZ: y, z) and `turns` is the signed integer rs274 prints: positive is counterclockwise seen from the positive end of the plane's normal axis (Z, Y, X), magnitude 1 for a single turn or partial arc\n- `{\"type\": \"dwell\", \"seconds\": s}`\n\nPositions are machine coordinates of the controlled point in mm: work position plus the active G54..G59 offset, the G92/G52 offset and the tool length offset, converted to mm in a G20 program. `feed` is the feed rate in effect for that motion, in mm/min. No other keys.\n\nIf rs274 stops with an error, return the motions it printed before stopping and `\"error\": {\"line\": n, \"code\": c}`, where `n` is the 1-based line of `program` holding the block rs274 reports as failing and `c` maps from its message:\n\n- `Radius to end of arc differs from radius to start` \u2192 `ARC_RADIUS_MISMATCH`\n- `Arc radius too small to reach end point` \u2192 `ARC_RADIUS_TOO_SMALL`\n- `Current point same as end point of arc` \u2192 `ARC_SAME_ENDPOINT`\n- `Length of cutter compensation entry move is not greater than the tool radius` or `Radius of cutter compensation entry arc is not greater than the tool radius` \u2192 `COMP_ENTRY_TOO_SHORT`\n- `Tool radius not less than arc radius with comp` \u2192 `COMP_ARC_TOO_SMALL`\n- any message ending in `without gouging` \u2192 `COMP_GOUGE`\n- `The move just after exiting cutter compensation mode must be straight, not an arc` \u2192 `COMP_EXIT_ARC`\n- `R less than z in cycle in xy plane` \u2192 `CYCLE_R_BELOW_Z`\n- `Cannot use axis values without a g code that uses them` \u2192 `AXIS_WORDS_WITHOUT_MOTION`\n\nInput domain: G0 G1 G2 G3 G4 G10 L2/L20 (P0 to P6) G17 G18 G19 G20 G21 G28 G30 G40 G41 G42 G43 G43.1 G43.2 G49 G52 G53 G54 to G59 G64 G73 G80 G81 G82 G83 G90 G91 G90.1 G91.1 G92 G92.1 G92.2 G92.3 G94 G98 G99; M2 M3 M5 M6 M8 M9 M30; words D F H I J K L N P Q R S T X Y Z; `( )` and `;` comments; any letter case and spacing. G20 or G21 appears, if at all, only in the first block that has a G or M word. Every T, D and H number is in the tool table, and a diameter can be negative. Canned cycles and cutter compensation are used only in G17. M6 never shares a block with G43/G43.1/G43.2/G49 and never follows a tool length offset change without a motion in between. Each program ends with M2 or M30 or is stopped by one of the errors above. Programs whose outcome hinged on a last-bit floating point tie were dropped.\n\nGrading: the grader has no LinuxCNC. Each program gets a fresh process, running as an unprivileged user that cannot start processes or open sockets, which imports a copy of `/app/toolpath.py` and makes one `simulate` call with 2 seconds of CPU. The 600 hidden programs are job-shop programs, randomized programs across the domain, and short corner-case programs. Discrete values must match exactly; positions, centers and feeds within 0.01 (mm or mm/min); dwells within 0.001 s. The task passes only if every hidden program matches. Examples with expected answers are in `/app/data/examples/`.\n\nYou have 28800 seconds to complete this task.\n", "public_examples": 59, "hidden_cases": 600, "hidden_unit": "programs", "grading": "Discrete fields exact, coordinates within 0.01 mm", "answer_key": "held_back", "answer_key_sha256": "b95ccb1b52361f7014326e699b4550dc148c31b7af14d6b514a296f8164989f5", "model": "claude-opus-5-5", "blind_attempts": 5, "blind_solved": 0, "closest_attempt": "10 of 600 hidden programs wrong"} {"task_id": "controlled-count-close-notes", "title": "Controlled-substance count close", "domain": "Hospital pharmacy", "summary": "Reconcile automated dispensing cabinets at shift close from the controlled-substance log that nurses, technicians and pharmacists write.", "deliverable": "reconcile(shift_dir)", "path": "controlled-count-close/notes", "instruction": "The inpatient pharmacy closes the controlled-substance books for its dispensing cabinets at the end of every shift, by hand, and wants that automated. /app/shifts/ holds ten past shifts that were reconciled by hand; their reports are in /app/examples/. Each shift folder holds log.txt, the shift's controlled-substance log as the nurses, technicians and pharmacists write it, one numbered entry per line (`#