# Experiments: unblackboxing with the kit

Each experiment is one Python script and one report. They use the annex's WSRF (Lars Rocha's Williams Structured
Random Forest) the way it is meant to be used: not as a black box that scores, but as a reader that finds the zone
boundaries in the data and prints them, so the rules it found can be set beside the laws that made the data.

## A reading order

1. **The forest reads a law back** (`UNBLACKBOX_TERRAIN.md`, then `UNBLACKBOX_ALMANAC.md`, `UNBLACKBOX_LIGHTCONE.md`): the prize rule, the almanac's periods and the light cone's bits come back as boundaries you can set beside the arithmetic. This is what the method is for.
2. **What it reads when the law is bigger than its features** (`UNBLACKBOX_CITYPLAN.md`, `UNBLACKBOX_CITYKINDS.md`, `UNBLACKBOX_RAILSLANE.md`, `UNBLACKBOX_VORTEX.md`): give it the quantity the law used (the square remainders, the nearest prime's residue, the Laplacian) and 0.76 becomes 1.000; withhold it and the forest proxies through what it has.
3. **What cannot be read, and why that is the result** (`UNBLACKBOX_DICE.md`, `UNBLACKBOX_GAUSSIAN.md`, `UNBLACKBOX_LEGENDRE.md`, `UNBLACKBOX_POKER_ZONES.md`): indexed randomness stays at the baseline, primality is not a function of small residues, the Legendre table is memorised not understood, a public poker snapshot does not predict the return.
4. **The forest against a search, a simulator and a rival** (`CONNECT4_PARITY.md`, `REGIMES.md`, `UNBLACKBOX_DETECTORS.md`, `UNBLACKBOX_DRIVING.md`, `UNBLACKBOX_LANTERNS.md`).
5. **What the experiments found wrong in the tool, and the fixes** (`WSRF_FIXES.md`): multi-class routing, a discovery that never finished, a calibrator applied to zones it was never fitted on. `KRAKEN_AUDIT.md` is the same discipline turned on a bug report.

| experiment | question | headline |
|---|---|---|
| `unblackbox_terrain.py` → `UNBLACKBOX_TERRAIN.md` | Can a forest rediscover the ruler? | Yes: prize → `rank ≥ 4.29 and sqrem_even`, settlement → `rank ≥ 6.05`, walkable → `height ≥ 21.5` (the water line is 22). Accuracy 1.000 on all three, the laws in the forest's own variables. |
| `regimes.py` → `REGIMES.md` | Regimes of the exact integer cascade: advancing or stalled? | The inviscid arrival slope measures −0.667 against the predicted −2/3; the forest's rule: the first shell's share above 0.202 of the initial energy means the cascade is still coming, below it the front has stalled. Accuracy 0.993. |
| `connect4_parity.py` → `CONNECT4_PARITY.md` | Is a parity feature worth more than a deeper search? | At equal depth the parity evaluator leads with the seats swapped (28–19, 24–15); two plies deeper the plain search wins. The feature is worth something and is not worth two plies; the gallery's win came from a parity evaluator that also searched deeper. |
| `unblackbox_citylaw.py` → `UNBLACKBOX_CITYLAW.md` | Can a forest read the site rule and the city law? | The eligibility rule (dry ≥ 2, the lowest sample above the water, score ≥ 10) comes back with accuracy 0.992 (longrange) and 0.998 (cities), boundaries on dry, lowest and spread; `kept` cannot be read from a row alone (the 160-cell gap is between rows): 0.965 and 0.926 with the errors exactly the gap rule; the city law on rulercity is one boundary, `rank ≥ 7`, accuracy 1.000. |
| `unblackbox_lightcone.py` → `UNBLACKBOX_LIGHTCONE.md` | Can a forest learn the light cone? | Bits with a period within the moduli it sees (4, 32, 256) it reads off `g mod 2^p(y)` at accuracy 1.000 below 2^16 and past 2^30 alike; bits 34 and 37 (periods 8,192 and 32,768) stay at the majority baseline, 0.50: the negative result, and the right one, since no function of `g mod 2^k` for k ≤ 12 has a longer period. The prefix law is computed, not learned. |
| `unblackbox_prizes_everywhere.py` → `UNBLACKBOX_PRIZES_EVERYWHERE.md` | The prize law and the lane rule on six worlds. | The prize law comes back once for all worlds (accuracy 1.000); the lanes: the hills, the ladder and the sea (seven lanes by the remainder mod 7) and the downs (the rank's row) at 1.000, the prime rails at 0.634, because that lane is the rail of the nearest prime, which the remainder and the rank cannot say. |
| `unblackbox_cityplan.py` → `UNBLACKBOX_CITYPLAN.md` | Can a forest read the city plan? | The height is `CUM[base + min_v2 + ring]`: a control forest given only those three reproduces it on every plain block (estates follow their own rule); the kit's classifier names the right boundaries and scores 0.96 exact (before the fix of 2026-09-27 it predicted only 7 of 11 classes at 0.30, a multi-class routing defect in its zone reputation, now fixed in sitoolz's copy: `WSRF_FIXES.md`). The kind is half in square remainders the forest is not shown: 0.68 with the shape remainder, 0.37 without. |
| `unblackbox_almanac.py` → `UNBLACKBOX_ALMANAC.md` | Can a forest learn the almanac? | Yes, exactly: cloud (period 64), rain (64) and wind (16) at accuracy 1.000 below 2^15 and past 10^9, with the boundaries on `t mod 64`, `t mod 64` and `t mod 16`, the theorem read back as a lookup in each bit's own period. |
| `unblackbox_detectors.py` → `UNBLACKBOX_DETECTORS.md` | Which detector next? | On states rebuilt with the lab's own features and detectors (1,059 training, 307 test), the kit's forest and the lab's shipped forest agree on 87 percent of states and score 0.53 and 0.55 against a majority label of 0.59: the ordering the lab learned is mostly the fixed order's tie-break, and the label is dominated by locked candidates. |
| `unblackbox_dice.py` → `UNBLACKBOX_DICE.md` | The dice cannot be read. | blake2b, jacobi, square and qrand stay at or below the majority baseline on parity and on the high half of the draw mod 6 (within −0.07 to +0.01 on 300 test rows); the edge backend, present to be seen to fail, is read at 0.92 and 0.71 from `index mod 2^k`: rule 30's edge is periodic in the index and the hash is not. Runs in 30 s (136 s before the feature screen and time budget of `WSRF_FIXES.md`). |
| `unblackbox_poker_zones.py` → `UNBLACKBOX_POKER_ZONES.md` | Poker zones with and without. | On a 4,000-row subsample of one recorded run the continuation return is not predictable from a public snapshot at all: the kit's regressor, zones discovered under a 25 s budget with 24 screened features, finds no boundary above the purity floor and scores 0.1706 to 0.1727 against a constant's 0.1671, with or without the LRO mapping features; the lab's own million-hand comparison, not this, is the policy answer. |
| `unblackbox_railslane.py` → `UNBLACKBOX_RAILSLANE.md` | The prime rails' lane, with the feature the law used. | With rank and the remainder the forest sits at 0.76; given the nearest prime's residue mod 4 it reaches 1.000 with one boundary on that residue, and the residue alone suffices: the Williams Theorem in miniature. |
| `unblackbox_driving.py` → `UNBLACKBOX_DRIVING.md` | Can a forest read a vehicle's model back? | A least-squares fit of the speed change reads every model's `accel` exactly (10.000, 7.000, 5.000, 15.000, 17.000, 12.000) and the drag as 0.700; the forest's question, whether the speed rises, is a diagonal in throttle and speed it can only approximate (0.77 to 1.00 across the six), and its clean read is the half-throttle rows, where its one boundary on `speed` lands within a few percent of `0.664 * accel`, the terminal speed the law predicts. |
| `unblackbox_citykinds.py` → `UNBLACKBOX_CITYKINDS.md` | The city law's block kinds, with the remainders shown. | Given the square remainders experiment 7 withheld, park, sky and dc are read at 1.000 on 1,884 blocks with the boundaries on `ring`, `L`, `n` and the right remainder (`r_park_mod4`, `r_sky_mod3`); step and court reach 0.983 against the shape remainder's 0.92 as a bare rule, the difference being the size clause the forest is not shown but proxies through `side`. |
| `unblackbox_gaussian.py` → `UNBLACKBOX_GAUSSIAN.md` | The Gaussian Isles: what primality is not. | On 20,736 cells split by the value of `a² + b²` (a split by cell leaks through the mirror cells, 0.998 in a first run), the forest fed residues mod 2 to 29 scores 0.920 under the sieve's 0.977: it cannot hold the ten-way conjunction the sieve is, and even the sieve stops at 0.889 precision, because primality is not a function of small residues. |
| `unblackbox_legendre.py` → `UNBLACKBOX_LEGENDRE.md` | The Legendre Marches: understanding against memorising. | With `a`, `b` and their low bits the forest sits at the majority (0.519 on 5,184 tiles), as the character's theorem says it must; with the residue `v` given it climbs to 0.79 by cutting the table, while the table itself, as a lookup from the same rows, is 0.990: neither is the law, which is two lines of reciprocity. |
| `unblackbox_vortex.py` → `UNBLACKBOX_VORTEX.md` | The Vortex Sea: the forest finds the curl. | On 16,384 cells of four frozen flows the sign of the vorticity is the sign of the height's discrete Laplacian, exactly (rule 1.000; the height alone 0.81); the discovery's one boundary is on `laplacian` at zero to six decimals with purity 0.9999 and, trained on 9,000 rows, predicts every cell (1.000); trained on all 12,288 it names the same boundary and then `predict` returns one class for every row (0.497), a defect on record for section 21. |
| `unblackbox_lanterns.py` → `UNBLACKBOX_LANTERNS.md` | The lanterns' words. | Text, not arithmetic: on 330 lanterns of 55 worlds as a bag of 60 words, split by world, the forest tells a ruler-land world from the rest at 1.000 on 18 unseen worlds with one boundary on the word `rank`, and an epic range at 0.92 (majority 0.78) on `blocks`, `run` and `wall`; it is reading the law's name off its explanation, not the law off the ground, which is the line this one marks. |
| `kernels.py` → `KERNELS.md` | What else a kernel can be? | Three more twins on the GPU, cell for cell: the light cone's tables (239x; rule 30's edge step is nonlinear, so one thread a column, not a scan), a whole region's city plans in one launch (region 5 to rank 17: 11,202,194 fields, 343x), WSRF's purity scan bit-identical over 2M rows × 8 × 256 cuts (~1,490x). Needs `sitoolz[gpu]`; skips without it. |
| `unblackbox_fleet.py` → `UNBLACKBOX_FLEET.md` | The fleet's rules, read back from driving logs. | Ten rules of `sitoolz.vehicles` driven over 4,000 indexed-random inputs each (seeds from `qrand`), the forest given the raw log: the switches come back exactly (the submarine's `depth` at 1 and `wet`, `dive`, `frost`, the hoverboard's `speed` at 1.5, the clamps), the diagonals only when the log carries the derived feature (`rise` at 0.98 = 1.4 − 0.42, `rail_distance` at 1.6, `ratio` at 0.63, `alt` at 0.65 and 0.049, `rel` at 0.5; without it 0.84 to 0.99 with the trees proxying), and the sailboat's cosine is drawn as 313 steps (R² 0.997, largest error 0.075), never named; the balloon's drift is sixteen values and a lookup at R² 1.000. 10.5 s. |
| `unblackbox_calibrator.py` → `UNBLACKBOX_CALIBRATOR.md` | The calibrator defect as an experiment: when does the forest fail, and how would you know? | The collapse test's planted problem swept over planted wrong-side rows (0, 1, 3, 10, 100), training size (2k to 20k), the `calibrate` flag and two seeds: the fixed kit is 1.0000 in all 80 cells; the old path, reconstructed in the script, predicts one class at 0.49 to 0.51 in all 32 cells with a calibrator and a planted row (the map's top 0.0013 to 0.5), and is the same code with the calibrator off. Two checks costing one `predict` on the training rows (fewer classes than the target has; a zone's own rows back under its purity) fire in exactly those 32 cells and never on the fixed kit. 39 s. |
| `unblackbox_burgers.py` → `UNBLACKBOX_BURGERS.md` | Can a forest read the integer Burgers step back, and see the blow-up coming? | On 39,424 site-steps a scheme (`fluidz`, N = 256, Lax–Wendroff and Engquist–Osher) the change at a site, `-(F_i - F_(i-1))` exactly, gets no boundary from the discovery and the trees draw it as steps: R² 0.89 to 0.94 inside the range trained on, 0.76 to 0.82 on the shock's last quarter, and 0.94 at best with the fluxes as features; the sign is read from `u` and `du` with cuts at −0.016 and 0.014 (the continuum's `u · u_x < 0`), 1.000 and 0.996. The blow-up: with `step` the forest reads a clock that runs at the wrong rate on the held-out amplitude (R² 0.79); on `grad` and `umax` alone it names `grad` at 8 and `umax` at 0.54 and draws 1/grad as steps (0.93) under the law `4N (1/grad − 0.05 T*)` (0.95); on the viscous run neither the forest nor the law knows there is no blow-up. 22 s. |
| `unblackbox_twins.py` → `UNBLACKBOX_TWINS.md` | Twin pairs against composites, with the forge. | On odd n to 2^16 and in the rails' region from 2^20, split by blocks of n, the forest fed residues mod 3 to 31, low bits, n mod 6 and the popcount names one boundary for the twins, `n mod 3` at 1 (n ≡ 5 mod 6), predicts none (the sieve's own survivors are only 35 and 23 percent twins) and ranks 12 and 8 percent twins at the sieve's flag count against the sieve's 35 and 23: the twenty-way conjunction is not held; the ten-way one for primes is, in the trees (precision 0.621, the sieve's), and given the sieve's two verdicts the ranking reaches the sieve's precision and no further. Nothing beyond mod 6 and the residues. 17 s. |
| `unblackbox_reach.py` → `UNBLACKBOX_REACH.md` | Reachable edge patterns without the period tables. | 8,176 patterns of 4 to 12 bits against one `edgecert` certificate to bit 24 (292 reachable, 2^p(J−1) a width); trained on J ≤ 10 the forest names one cut, `first_zero` at 5.35 (the ladder of leading runs 1, 3, 4 against 6, 7, 9), and on J = 11 and 12 scores 0.961 and 0.953 under the majority's 0.969 and 0.984, precision 0.435 and 0.205 at recall 0.78 and 0.70: the last bit is a period table it never saw. p(J−1) and the phase count add nothing (constants across these widths); the prefix's own reachability gives exactly the prefix rule (precision 0.500, recall 1.000); a split by row does not memorise (recall 0.207), since no two patterns share a row. 2 s. |

Run any of them from the repository root: `python3 experiments/unblackbox_terrain.py`. Each is under two minutes.
