S04 · Quantum & Scale · L-17
Bytecode Constant-Fold
- Difficulty
- expert
- Type
- implementation
- Session
- Deep
- Stack
- Python python3.11
- Domain
- Compilers
- Est. solve
- ~35 min
01 · The task
Write the constant-folding optimization pass for a small bytecode IR, on top of the provided parser and evaluator. The catch is doing it safely — collapsing what is genuinely constant while leaving the program's observable behavior exactly as it was. Dead-code elimination is an optional, separately-scored bonus.
02 · Constraints
DCE is bonus
Dead-code elimination is an optional, separately-scored extra.
03 · Skills exercised
How to playDaemon
The whole level runs through the local promptly daemon — it pulls the workspace, captures your token usage, tests locally, and submits the ranked run.
Pair this machine
One-time — approve the code under your devices.
promptly pairPull the workspace
Downloads the starter kit into
constfold/and starts the solve clock —cdin before the next step.promptly init constfoldStart the captured session
Then drive your AI tool — the daemon meters every prompt and token live.
promptly startSubmit for ranked grading
Runs the full hidden suite and ends the attempt.
promptly submit
Or combine steps 02–03 into one commandShortcut
promptly play pulls the workspace, launches the daemon, and starts the captured session in a single step — the same as running init then start. Then cd constfold and drive your harness.
promptly play constfold