Commit graph

215 commits

Author SHA1 Message Date
acamilo
96e3ffeeb1 examples: row 66 survey counters
trap_hunt: a shop/ball/catch tally (pad frames, starts, outcomes, balls,
party+box, Pokedex owned, mart entries) and FLY_TRAP_LOG_MACROS=1.
scene_probe offers: catch, party and Pokedex counts, FLY_PROBE_SCREEN_*
screen dumps, FLY_PROBE_SAVE_MART to save a mart entrance.
2026-09-29 13:55:23 +00:00
acamilo
36325d82dd palette: a counter the fly walked away from is not walked back to for the window
Row 62 re-deals GO SHOP/GO HEAL whenever the service is needed, with no
window. Live on v0.6.5 from the rung-8 archive that was a ring: GO SHOP to
the Viridian clerk, GO OUT/GO OBJECTIVE back out without TALK, GO SHOP again
(33 in 35 minutes). A completed GO SHOP/GO HEAL facing the counter person now
records TargetKey::Counter on the building's map; the service walk toward it
is withheld for the reached window, from the street and inside. TALK at the
counter is unchanged.

ROM row66 test (FLY_ROW66_MART_CHECKPOINT): base 31 street GO SHOPs in 10,000
frames, branch 0.
2026-09-29 13:55:23 +00:00
acamilo
5269c2f142 state: the battle bag is open only while its box is on screen
wListMenuID keeps ITEMLISTMENU after the list closes, so from a catch to the
end of the battle (caught text, Pokedex page, nickname offer, naming screen)
the pad read as the bag: BACK and THROW BALL, whose A presses typed the name.
The bag now also needs its TextBoxBorder at (4,2)-(19,12).

rom_catch: row66 test (THROW BALL dealt after the catch: base 666 frames,
branch 0), and both tests retry from idle offsets because one ball misses
about two throws in three and frame timing decides which.
2026-09-29 13:55:23 +00:00
acamilo
ceaf55ad48 macros: a yard's one door is taken, and a split map's exits are the fly's own piece's
Cerulean's badge house back door leaves the fly on (9, 9), the door tile of a
closed yard; the pad was empty for the rest of the survey.

- The exit walks fall back on a step-fired warp underfoot once every listed
  goal has failed the route search (goals_of set it aside while any other exit
  was listed, reachable or not).
- The decoded grid marks warp carpets (warp_carpet_tile_ids.asm) on the maps
  whose ExtraWarpCheck reads them; a walk whose goal is a warp underfoot bumps
  toward one (CheckWarpsCollision) instead of row 64's sideways step-off, which
  fires nothing on a tile that is no door.
- The badge house is on the map graph and the yard is a piece of Cerulean, so
  GO OUT in the house takes the front door.
- path::exits keeps the fly's own piece on a split map: refusals from the yard
  no longer rest the town's exits for the whole map.
- The 12.28 guarantee reads where the fly stands: a same-map teleport moved it.

ROM test row65_the_fly_leaves_the_cerulean_badge_houses_back_yard
(FLY_ROW65_YARD_CHECKPOINT); scene_probe's route survey can save its caught
frame (FLY_PROBE_SAVE without FLY_PROBE_SAVE_RANK).
2026-09-29 04:01:16 +00:00
acamilo
2f869fd4bc macros: a floor whose way on is a passage deals no GO OUT fallback
GO OUT's "a room has to be leavable" tier dealt Mt. Moon 1F's mouth back onto
Route 4 (visited, away from the rung) one step from the tile the fly arrives
on, and Route 4's GO ROUTE / GO OBJECTIVE walked it straight back in. With row
62's GO HEAL bringing a hurt fly back to that tile, rows 62+63+64 crossed
Route 4's west doors 34 times in row 59's ROM test (bound 25).

While an unrested passage leads toward the objective, the way out has no
fallback: GO WARP's rule the other way round. The blocked window is the escape
hatch; tiers one and two (somewhere new, toward the objective or an errand)
are untouched, and a hurt party keeps GO HEAL.
2026-09-29 04:01:16 +00:00
acamilo
19d295d111 tests: close row 62's last test, whose brace the row 64 merge took as shared context
Both branches appended tests at the end of the file; resolving the
conflict as both sides left row 62's final test without its closing
brace.
2026-09-29 01:47:23 +00:00
acamilo
ccba5d75a2 tests: row 64's ledge test sees Route 4's centre, which row 62 made an errand
review-row62-r2: merged, the Mt. Moon centre is the errand ahead of the
test's goal on Route 4's west side; the behaviour is right, the fixture
predates row 62.
2026-09-29 01:31:22 +00:00
acamilo
ce12a1d7a5 Merge fix/loop-row64
# Conflicts:
#	docs/design/macros.md
#	infra/docs/macros-traps.md
#	services/flysim/crates/flybrain-gb/src/pokemon_red/macros/tests.rs
#	services/flysim/crates/flysim/tests/rom_macros_mode.rs
2026-09-29 01:31:22 +00:00
acamilo
e2e830076e Merge fix/loop-row62
# Conflicts:
#	docs/design/macros.md
#	infra/docs/macros-traps.md
#	services/flysim/crates/flybrain-gb/src/pokemon_red/macros/tests.rs
#	services/flysim/crates/flysim/tests/rom_macros_mode.rs
2026-09-29 01:30:32 +00:00
acamilo
b6e552ace2 tests: the row 62 east test's first sighting as a plain tuple 2026-09-29 00:18:27 +00:00
acamilo
83e842aee2 macros: a way out that does not take the fly anywhere is not done
The general half of row 64: section 12.2's rule ("a macro that completes
without moving because its precondition is already satisfied is a trap")
held by the executor for every way out, instead of by each macro.

A way out's promise is another map. A Settle arrival on an exit key that
leaves the fly on the same map now ends Blocked, so the exit rests in the
blocked ledger for the window. When the fly never left the tile it pressed
from, row 57's refused-from-here ledger also keeps that button off this
tile for the window, because the last resort ignores the blocked ledger
and would otherwise re-deal the same dead exit once per hold. Nothing is
pressed, ranked or chosen: two ledgers that already exist get one more
honest writer. A pad with nothing left that can run is empty and waits.

On base with only this commit, from the live row-64 checkpoint (72k
frames, GO OBJECTIVE/GO WARP preferred): GO OBJECTIVE done in place 1,500
-> 0; the fly leaves the ladder tile and moves on (still not to Cerulean,
which needs the ledge knowledge). The test fixture's settle now drains the
refused ledger after every finish, as PokemonPalette::record_talk does.
2026-09-28 23:38:06 +00:00
acamilo
f4946ce744 tests, docs: row 62 round 2, GO HEAL east of Mt. Moon on the cartridge and the two limits in 12.26 2026-09-28 23:37:40 +00:00
acamilo
e10f48e1c7 macros: a ledge is a hop the route search takes the one way the cartridge does
Row 64, the source of the Mt. Moon ring. Off the ladder, the road reaches
Route 4 east of the mountain, where Cerulean is three ledges down. The
collision list calls a ledge tile a wall, so the route search had no road
from the cave's exit to Cerulean at all: GO OBJECTIVE refused no route, the
east edge rested in the blocked ledger, and the other walks took the fly
back into the cave, onto B1F's exit (27, 3) or down B1F's ladder to B2F
(5, 7), where the ladder ring took over.

- The decoded grid marks LedgeTiles hops (data/tilesets/ledge_tiles.asm,
  OVERWORLD tileset only, the lower-left anchor tiles HandleLedges reads).
- The route search takes a hop from above as one press that lands two
  tiles on; from below a ledge stays a wall; the flood the map's pieces
  are measured with is unchanged.
- The walk holds while the cartridge carries the fly over (scene Unknown,
  scripted, on the hop's own line), so a hop it asked for is not written
  as a push-back.

ROM test from the live checkpoint (FLY_ROW64_CHECKPOINT): base stays on
(5, 7) with 167 done-in-place and never leaves B2F; branch takes the
ladder on the first GO OBJECTIVE, hops Route 4's ledges and reaches
Cerulean City at frame 1,972 with the pushed ledger empty.
2026-09-28 22:50:34 +00:00
acamilo
014d869e14 macros: a walk that starts on its own ladder steps off and back on to take it
Row 64, Mt. Moon B2F (5, 7), two days live. A warp whose exit has no press
fires at the end of a step onto it (CheckWarpsNoCollision) and at no other
time; a bump into the wall beside it warps only at a map edge off the
overworld (ExtraWarpCheck). The fly came down the exit ladder and stood on
it, and GO OBJECTIVE and GO WARP both aimed at the tile underfoot, settled
there and reported done without a press, 27 frames each, ~750 per ten brain
minutes. No ledger was involved, so restarts restored the ring.

A walk whose goal is a step-fired warp the fly already stands on now steps
onto free ground beside it (never another warp) and back, which is what
fires it. Nothing else changes: the pad, the ledgers and every other
arrival are as they were.
2026-09-28 22:49:17 +00:00
acamilo
f2d8a2d491 palette: a centre is the area's from ground the route to it stays on, and no service leaves the rung's room
Review round 2 of row 62. Route 4's east side and Mt. Moon B1F's exit chamber are in
Route 4's area, but the only road to its centre runs through B2F, which is in none:
GO HEAL (and the errand under GO OBJECTIVE) walked into B2F and dropped there, opposite
the road to Cerulean. A building is the area's errand or service only where
geography::route_within holds. And a service is not wanted while the rung's own target
stands in the room (row 29's rule, row 58's gym bounces).
2026-09-28 22:12:09 +00:00
acamilo
2fb5e37ab4 scene_probe: FLY_PROBE_CATCH=offers, what the pad deals frame by frame
Twenty brain minutes of the service's frame behind a uniform stub,
counting per decidable frame which shop, centre and ball buttons are on
the pad and what comes of the ones pressed, beside the cartridge's own
heals, purchases, throws, catches, whiteouts and wLastBlackoutMap. With
FLY_PROBE_PREFER, FLY_PROBE_PADS and FLY_PROBE_TRACE_MACRO for the
mechanism (loop review row 62).
2026-09-28 22:08:17 +00:00
acamilo
d188a59495 tests: row 62's ROM proofs, HEAL in the Mt. Moon centre and a ball bought in Pewter
From the Mt. Moon centre with the party at 10/70 (FLY_ROW62_CENTER_CHECKPOINT):
HEAL is dealt, heals, and wLastBlackoutMap becomes Route 4. From the
rung-11 Pewter checkpoint with the errands paid, 1,606 and no ball
(FLY_ROW62_MART_CHECKPOINT): GO SHOP is on the pad, walks into the mart,
and BUY BALL reports done only with the ball in the bag and 200 paid.
Both fail on main 862e343 (HEAL never dealt in 3,000 frames; GO SHOP not
on Pewter's pad).
2026-09-28 22:08:17 +00:00
acamilo
87d31bcade palette: a centre or a mart with a job to do is dealt again, and its counter person is found from the door
The errand is paid by the first visit, including one on which the counter
could do nothing (the Viridian clerk handing over Oak's parcel, a centre
entered with a full party), and GO SHOP / GO HEAL never came back; a
counter person this session had talked to or reached was retired for it
too. Live: eleven hours, GO SHOP twice (the parcel), no BUY, no HEAL, no
throw, wLastBlackoutMap still Pallet Town.

service_needed reads the cartridge each time: a centre while the party
needs rest, a mart while the bag has no ball, the wallet covers one and
the bag holds no Oak's parcel. It satisfies itself (a heal leaves the
party full, a purchase leaves a ball). GO SHOP / GO HEAL aim at the
area's building while it holds; inside, the counter walk and TALK at it
ignore the talked and reached ledgers (blocked is kept). HEAL's goals
keep the tile that already faces the nurse, where GO HEAL leaves the fly.
The counter person is read from the drawn and the off-screen sprites
(row 58's reading): from a centre's door the nurse is six rows up and
off the screen, so HEAL, GO HEAL and the counter's suppression were all
off on arrival (loop review row 62).
2026-09-28 22:08:17 +00:00
acamilo
9ad2feff5c executor: a purchase answers the price box the cartridge drew, and is done when paid
After the quantity the mart prints "That will be" and waits for a press
(a cont), then prints the price and only then draws its YES/NO box. The
script's one blind A after a settle was that press, so BUY BALL reported
done before the box existed: 55 starts, 55 done, the wallet unchanged,
from the rung-11 Pewter checkpoint. Step::Prompt pulses A until the box
is drawn (yes_no_prompt, row 56's reading), Step::Paid waits for the
wallet to drop; either running out is blocked. The fake mart now prints
its price, draws the box and charges for a YES (loop review row 62).
2026-09-28 22:08:17 +00:00
acamilo
019bd02dfe geography: Route 4's Pokécenter is a centre on the map graph
MT_MOON_POKECENTER ($44, Route 4's warp at (11, 5)) joins LINKS, Route
4's west piece and AMENITIES as Route 4's centre. It was on no table,
so HEAL was never dealt in it and no errand could walk to it: the last
centre before Mt. Moon, where the live run spent 3.5 hours whiting out
(loop review row 62).
2026-09-28 22:08:17 +00:00
acamilo
f6e3013708 tests: the own-turn pad measure skips a menu the cartridge still holds an A on 2026-09-24 05:29:03 +00:00
acamilo
e170812e7c palette: a battle menu the cartridge still holds an A on deals no pad
RUN's A is taken and the menu's box stays up while the game stops asking the joypad; a
macro dealt on those frames pressed at a menu already gone and held the pad for its cursor
wait. Empty until the cartridge asks again, 12.13's reading.
2026-09-24 05:29:03 +00:00
acamilo
68b756d824 tests: row 63's ROM proofs, the Potion used from the Mt. Moon checkpoint and the two pinned addresses read back 2026-09-24 05:29:03 +00:00
acamilo
4178a20529 palette: MOVE 1 is FIGHT's backstop only while nothing else is a move, and ITEM asks the cartridge about its Potion 2026-09-24 04:49:40 +00:00
acamilo
86149dca9b executor: a confirming A waits for the cartridge to have let go of the last one
The Potion's party list reads open before the game asks the joypad again, and until it asks
the A that opened it is still in hJoyLast: an A pressed there is no edge. ITEM confirmed on
that frame, reported done over a list still waiting, and the fly backed out with BACK, BACK.
2026-09-24 04:49:40 +00:00
acamilo
944c9204e0 scene_probe: FLY_PROBE_CATCH=bag and =potion, row 63's battle survey and the party list's A window 2026-09-24 04:49:40 +00:00
acamilo
113970f4e1 state: what the cartridge does with an item from the battle bag, and whether it still holds an A
item_routine reads ItemUsePtrTable ($03:$55E1) by id and checks it by its own shape;
battle_item_use answers each routine's refusal on bytes already in WRAM. a_latched reads
hJoyLast, the reading the joypad edge is made against. MacroState gains item_refused and
a_latched, both off by default.
2026-09-24 04:04:08 +00:00
acamilo
cff15804fb state, tests: the challenge covers the "!" bubble too, the doc block back above its impl, and the ROM test asserts no pad inside a challenge 2026-09-23 23:47:36 +00:00
acamilo
c78ca352f6 tests: the ROM proof from the forest's south gate checkpoint 2026-09-23 23:28:05 +00:00
acamilo
0e366cd4e4 state: a trainer's challenge is the cartridge's until its battle is over, in the macros' own scene 2026-09-23 23:27:54 +00:00
acamilo
16bc65b5a8 survey: FLY_PROBE_CATCH_FRAME reads the first free frame from a given one, FLY_PROBE_WHOLE prints a big map whole 2026-09-23 23:27:54 +00:00
acamilo
9ccc0592b1 docs: macros.md 12.24 and the row 59 audit 2026-09-23 22:33:47 +00:00
acamilo
437dfa84a9 tests: from the live Route 4 checkpoint, the fly goes into Mt. Moon and Route 4's west doors are not a ring 2026-09-23 22:33:47 +00:00
acamilo
d181f952a7 tests: from the badge, the road to Mt. Moon is not a ring at the Pewter end, and Route 4's doors and sides are the cartridge's 2026-09-23 22:23:27 +00:00
acamilo
5147ab1a87 geography: a header connection no step on foot crosses is named and is not a way out; Pallet's shore, the sea routes, the League fence 2026-09-23 22:23:01 +00:00
acamilo
97a97a501d geography: a split map is pieces with their own doors and neighbours; Route 4 and Mt. Moon's lower floors, the hop matched on where an exit lands 2026-09-23 22:23:01 +00:00
acamilo
4108fec5ce macros: a push-back is a refusal once the overworld has stayed the fly's for half a second, not on the first frame of it 2026-09-23 22:23:01 +00:00
acamilo
d85ee5026f geography: Route 3/4, 14/15 and 24/25 as the headers connect them, and Mt. Moon's doors on Route 4 2026-09-23 22:23:01 +00:00
acamilo
288e958d19 survey: FLY_PROBE_SAVE_RANK writes the first safe overworld frame at a rung as a checkpoint 2026-09-23 22:23:01 +00:00
acamilo
4d82f7db74 Merge refactor/legacy-frame: FND-01, one LegacyFrame for the service and every harness, FLY_TRACE and the sugar journal 2026-09-23 21:43:45 +00:00
acamilo
ff49b56e2c docs: the explore row stays "new place" 2026-09-23 21:23:40 +00:00
acamilo
9e2f90749f flysim: FLY_TRACE's boundary half read back with fly-session-types, the journal held to the service test, rustfmt on the new files 2026-09-23 20:15:20 +00:00
acamilo
60f09b79a3 flysim: every harness runs the legacy frame: the trap hunt, the benches, the ROM tests' and the probe's stub drivers
trap_hunt, palette_bench and room_escape ran the frame through NeuralAgent::tick, which installs
a frame and its rewards after the next ticks: one frame behind the stream, with the ratchet
observed without the objective signal and a rollback that never re-observed the scene. They now
restore the way the stream restores and run LegacyFrame::transition and ::boundary, looking in
through FrameObserver; FLY_TRACE works in each of them. The stub-readout drivers of
rom_macros_mode, rom_catch and scene_probe run LegacyFrame::execute and ::stub_advance, which are
the same calls they made, in the same order.
2026-09-23 20:15:20 +00:00
acamilo
ad1c0e3693 flysim: a frame-stamped sugar journal in the hot directory
Every admitted sugar and operator reward pulse is appended to sugar-journal.jsonl with the frame
counter it was applied at, which is the step of the next transition in FLY_TRACE, so a shadow run
can replay the audience's input. Append-only, not checkpointed, never read back into the fly.
2026-09-23 20:14:01 +00:00
acamilo
94cc91369a flysim: the legacy frame is one type, flysim::frame::LegacyFrame, and the sim loop runs it
prepare, execute, advance, evaluate, commit, then the boundary's ratchet capture and rollback,
in the order the stream runs them. The frame owns the remainder, the frame counter, the frame on
screen, the mask and the blocked-direction window; the sim loop keeps the feed, the event log,
the milestone archive between commit and boundary, and the checkpoints. Two moves between
disjoint state change no byte: the visual frame is installed at commit, and the stimulations
follow the scene's observation. The FLY_TRACE of a run from the rung-10 checkpoint is
byte-identical to the one the inline hooks wrote.
2026-09-23 20:14:00 +00:00
acamilo
ff74c07622 flysim: FLY_TRACE, a per-frame trace of the legacy loop in the step trace's field names
One JSON line per transition: ticks and the exact remainder, digests of the rates, of the
transition's spikes, of the frame and of work RAM, the decision and the mask, macro and reward
events in order, the rank, and the boundary's slot saves, rollback and captures in the shape of
TraceBehaviour.boundaryActions and TraceOperational.captures. Off unless FLY_TRACE names a file.
Recorded inline in step_frame first, so the frame's extraction can be held to it.
2026-09-23 20:14:00 +00:00
acamilo
bc117ad470 flybrain-gb: say what a move with power does not promise 2026-09-23 19:23:48 +00:00
acamilo
07f88c443a tests: the ROM proof from the Route 1 checkpoint 2026-09-23 17:23:05 +00:00
acamilo
b33af9e772 scene_probe: the route survey prints the battle bytes a MOVE n button's effect rests on 2026-09-23 17:23:05 +00:00
acamilo
a02d5f7995 trap_hunt: payouts by kind, battle lengths and wins, and MOVE n on a move without effect 2026-09-23 17:23:05 +00:00