# brainrot 006: chernobyl simulator Live: https://brainrot.runfridge.dev/006/ Source: https://github.com/hwhang0917/brainrot/tree/main/006 License: MIT (see LICENSE at repo root); attribution only, no warranty. Sounds: the .mp3 files come from Mixkit and Pixabay under their own licenses, not MIT (see LICENSE). ## What it is A Soviet-style control room for Chernobyl Unit 4's RBMK reactor, laid out as panel "plates": analog meters (thermal MW, electrical MW, fuel °C) and a reactivity bar in dollars; the rod-control lever (СУЗ) and the AZ-5 emergency button; a CRT porthole with a side cutaway of the core (graphite stack, fuel channels with boiling coolant, rods with graphite displacers, fission sparks); a second porthole of the turbine hall loops; a round core cartogram; an annunciator of lamps; toggle switches for 4 circulation pumps, feedwater and the turbine; a slide-out DP-5 dosimeter that pegs at 3.6 R/h and ticks when open. The wall clock starts at 01:23:00. Outcomes: hold steady, melt down (corium pool, status banner), or explode (debris flies out of the porthole, cracked gauge glass, screen shake, the panel loses power, smoke and embers rise behind the panels, red rotating emergency light, fire alarm). The ☰ menu runs scripted scenarios: "How it happened: AZ-5" (the rundown test from the day before, time-lapsed, ending at 01:23:40), "Meltdown" (pumps lost one by one), "Normal operation", and "Manual control" to take over. Scripts lock the lever, AZ-5 and switches and narrate a shift-log line per step. Other controls: RU/EN toggle for the panel engravings only (descriptions, help and log are English), ? help tip and −/+ fold on every plate, Reset (reloads the page), mute, 📺 CRT. Sound: Geiger clicks per fission, recorded switch clack, alarm siren, plant hum loop, explosion, fire alarm, synthesized AZ-5 thunk; muted until the sound gate is answered. No URL params. ## How it was built - DOM/CSS for the panel (index.html holds ~350 lines of inline CSS: meters, plates, lamps, folded/scripted/exploded/meltdown/dead body classes, siren beam). pixi.js 8 for three canvases: the core porthole (in main.ts), the turbine hall porthole (turbine.ts) and the full-screen smoke plume (smoke.ts). The cartogram is Canvas2D. - Model (reactor.ts) is a lumped point-kinetics RBMK in "game time" (seconds stand for minutes to hours). Reactivity in dollars; growth = ρ/3 s below 1 $, and above prompt critical an extra (ρ−1)/0.08 s, so power runs away in fractions of a second. The three design flaws are all in it: positive void coefficient (0.8 $ per void fraction), graphite displacers that ADD up to 2.5 $ over the first 10% of rod travel (the positive scram), and slow rods (insert 0.05/s, i.e. 20 s scram; withdraw 0.012/s). Also Doppler feedback (−0.0029 $/°C), iodine→xenon poisoning (I τ 30 s, Xe τ 60 s, burn-off with power), decay heat 7%, pump count driving both cooling and flow (void follows power per unit flow, so coasting pumps boil more water), feedwater loss adding void, turbine trip removing void. A `base` offset makes the starting state (rods 0.5, power 0.5) an exact equilibrium. - End states: exploded if power > 5× nominal, or fuel > 2800 °C while ρ > 1 $ (fuel fragments into the water); meltdown if fuel > 2800 °C otherwise (power dies away, corium settles at 2600 °C). - Scenarios (scenarios.ts) are timed steps on the model clock: each fires once, says one log key, may call model setters, set the wall clock, or `skip` model seconds (fast-forwarded at 25 model s per wall s while the clock whirs to `clockTo`). The page reloads on choosing a scenario (sessionStorage `brainrot-6-scenario`) so every run starts fresh, then `syncControls()` moves the lever and switches to mirror the model. - From the git history (all prompted, iterated commit by commit over 2026-10-08..12): RU/EN toggle and fixed-width readouts first; then the realistic panel, cartogram, in-canvas explosion and meltdown; pump/feedwater/turbine switches became live; dosimeter; the ☰ scripted runs; core telemetry as a cutaway; synthesized noise replaced by recorded switch, alarm and explosion samples; turbine hall moved to Pixi with flow inertia, boiling, rotor dynamics, condensation; scripted runs lock the controls; CSS smoke replaced by a Pixi particle plume; Reset returns the lever (browsers restore range values across reload). Later: plant hum loop, fire alarm and red emergency lighting (reworked into a rotating siren beam light enough that the panel stays legible), all samples fetched and decoded at startup so the hum is back immediately after a reload. Last: the model gained flow-driven void so the real rundown-test mechanism exists, and the explosion script gained the day-before prelude (a day at full power loads iodine, the grid controller's nine-hour hold turns it into a deep xenon pit, which is why the night shift pulled every rod). - Vibe coded: prompted into existence with a coding agent. ## Files - 006/index.html: the whole panel markup and inline CSS (plates, meters with data-max/data-step, lamps, switches, menu, log, status banner, dosimeter drawer, flash, warning light, smoke canvas). - 006/main.ts: wires everything: i18n LABELS (ru/en), shift-log LOG text, controls, sound (samples, loopers, knock), core porthole Pixi drawing incl. explosion debris and melt, cartogram, meters/lamps/dosimeter, wall clock, scenario runner, folds and help tips; imports `geiger` (002/audio.ts), `mountCrt` (lib/crt.ts), `mountSoundGate` (lib/soundGate.ts). It does not mount lib/hud.ts. - 006/reactor.ts: pure reactor model (`create`, `step`, `setRods`, `scram`, `setPumps`, `setFeedwater`, `setTurbine`, constants). - 006/scenarios.ts: `SCENARIOS` (explosion, meltdown, normal), `advance`, `fastForward`, `NORMAL_RODS`. - 006/turbine.ts: `createTurbine(canvas)`: Pixi turbine-hall porthole driven by the reactor (pump flow inertia, riser bubbles, drum level, rotor spin-up/coast, condensate, grid trace, post-blast venting); exports `polyline`, `pointAt`, `wrap` helpers. - 006/smoke.ts: `createSmoke(canvas)`: full-screen Pixi smoke plume with embers after the blast. - 006/reactor.test.ts: holds steady alone; full withdrawal runs hot but Doppler stops short of explosion; AZ-5 from fully withdrawn at high power explodes; AZ-5 from normal shuts down; xenon pit; pump loss melts rather than explodes; feedwater loss raises power, turbine trip lowers it. - 006/scenarios.test.ts: explosion script blows within 3 s of AZ-5 and not before; prelude poisons deeper than a plain drop; meltdown script melts despite scram; normal script settles at 0.85–1.15 power with |ρ| < 0.1 $. - 006/turbine.test.ts: polyline arc-length walking and `wrap`. - 006/*.mp3: switch.mp3, alarm.mp3, plant.mp3 (looping hum), firealarm.mp3, boom.mp3, imported with `?url`. ## Extending it - Run: `npm install && npm run dev`, open http://localhost:5173/006/ . Tests: `npm test`. Typecheck+build: `npm run build`. - Physics knobs: the constants at the top of reactor.ts. Every one is load-bearing for the tests above (e.g. TEMP_COEF must cap a full withdrawal below meltdown while AZ-5 from rods-out still explodes; EXPLODE_POWER and TIP_BONUS/TIP_RANGE make the positive scram). Retune only with `npm test` green. - Scenario timings in scenarios.ts are tuned against the model (e.g. the 40 s hold lands the test drop near the xenon peak; AZ-5 at t=299). If you change the model, rerun scenarios.test.ts and retune `at` values. - New scenario: add steps to `SCENARIOS` and `ScenarioName`, its log lines to `LOG` in main.ts, a `data-scenario` button in the ☰ menu in index.html, and a label key in both `LABELS.ru` and `LABELS.en`. Scenario steps act on the model only; the page mirrors controls afterwards. - New panel label: add `data-i18n="key"` in HTML and the key in both languages. Only engravings are bilingual; keep help, log and status English. - Panel/UI tuning (meter scales, alarm thresholds, dose model, sound gains, cartogram, explosion debris) is the constant block at the top of main.ts. - Gotchas: Reset and scenarios reload the page, so anything that must survive is in storage (localStorage `brainrot-6-lang`, `brainrot-6-folded`; sessionStorage scenario); the lever value must be set explicitly at load. Samples are decoded ahead and played through `sound.output()` (the Geiger compressor), so mute covers them. 002/audio.ts is shared with page 002. - Conventions: keep pure simulation in its own module with a `node --test` file beside it; match the surrounding code style; Conventional Commits `type(006): message`.