Merge fix/loop-row72 (coordinator review: test-only, both tests stale): the GO SHOP and GO HEAL ROM tests start where the macro is dealt

This commit is contained in:
acamilo 2026-10-02 00:44:35 +00:00
commit 74a3c12857
2 changed files with 52 additions and 56 deletions

View file

@ -2184,9 +2184,10 @@ Knowledge inside macros, never in the choice; the pad still lists buttons and th
- **Ladder.** Unchanged; no reward for shopping or healing (rewards are the adapter's, - **Ladder.** Unchanged; no reward for shopping or healing (rewards are the adapter's,
untouched). untouched).
- **Screen.** Two new channel tags; the cells and the MACROS rate row take them as they come. - **Screen.** Two new channel tags; the cells and the MACROS rate row take them as they come.
- **Proof.** ROM-gated from the Viridian checkpoint: `GO SHOP` enters the Viridian mart and - **Proof.** ROM-gated: from the Viridian checkpoint `GO HEAL` enters the center and `HEAL`
`BUY POTION` buys one; `GO HEAL` enters the center and `HEAL` restores the party; the errand is restores the party; from the rung-11 Pewter checkpoint (a state where `GO SHOP` is dealt, since
not offered again in Viridian; trap hunt before/after. rows 62/66: money, no ball, no parcel) `GO SHOP` enters the mart and walks to its counter, and
is not dealt back from the street for the reached window; trap hunt before/after.
## 14. The full pad and four move buttons (the operator, 2026-09-17: "scoot fly over. make it 2 ## 14. The full pad and four move buttons (the operator, 2026-09-17: "scoot fly over. make it 2
## columns" … "four, one per move slot" … "2 cols.") ## columns" … "four, one per move slot" … "2 cols.")

View file

@ -2068,60 +2068,54 @@ fn nopp_checkpoint() -> Option<flysim::store::Checkpoint> {
// Section 13: the errands, a purchase and a heal, from the release box's own checkpoint // Section 13: the errands, a purchase and a heal, from the release box's own checkpoint
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
/// `GO SHOP` walks the fly into the Viridian mart, once, and then to its counter. /// `GO SHOP` walks the fly into the town's mart, once, and then to its counter.
/// ///
/// **What is proven here, and what is not.** The errand works: from the release container's own /// **From a state where `GO SHOP` is dealt.** Since rows 62 and 66 `GO SHOP` is on the pad while
/// Viridian checkpoint the fly is inside the mart in 1.4 brain minutes, the errand is discharged /// `service_needed` holds -- no ball in the bag, the wallet covers one, no Oak's parcel -- and the
/// on arrival and `GO SHOP` is never on the city's pad again. Inside, `GO SHOP` walks it to a tile /// parcel errand is `GO OBJECTIVE`'s (`the_objective_is_the_errand_and_macros_mode_walks_to_it`).
/// it can talk to the clerk from — which needs the counter reach, because every tile beside a /// The Viridian stall checkpoint carries the parcel, so `GO SHOP` is rightly not dealt there; this
/// clerk behind a desk is a wall. /// test starts from the rung-11 Pewter checkpoint (money, no ball, party hurt), where it is. The
/// ledger half of the old claim ("paid once, never offered again") is row 66's counter window now:
/// once the counter has been faced, the service walk is off the street's pad for the window.
/// ///
/// **The purchase is not ROM-proven from this checkpoint**, and the mechanism is named rather than /// **What is proven here, and what is not.** The errand works: the fly is inside the mart, `GO
/// papered over (`infra/docs/macros-traps.md` rows 33b and 34b). Two things are in the way, both /// SHOP` walks it to a tile it can talk to the clerk from, and the way out is withheld while the
/// measured on the cartridge on 2026-09-17: /// counter is unfaced. **The purchase is not ROM-proven from this checkpoint**
/// /// (`infra/docs/macros-traps.md` rows 33b and 34b): a counter *faced* is lost to the next hold,
/// - the screen-buffer tile read disagrees with itself on a map smaller than the screen. In the /// since a hold is 800 ms and whichever macro wins the next one turns the fly away before the A
/// Viridian mart the same tile reads walkable-and-counter from one of the fly's tiles and /// press. The purchase scripts themselves are covered by the fake-game tests
/// wall-and-not-counter from another two tiles away, because an 8x8 map cannot centre under a /// (`a_purchase_navigates_by_the_items_place_in_the_stock_list`).
/// ten-by-nine view. `facing_target`'s reach is taken from the *map id* for exactly that reason,
/// but the walk's own goals are still priced off the tile read;
/// - a counter *faced* is lost to the next hold. `GO SHOP` ends standing at the counter looking at
/// the clerk, and `TALK` is on the pad there — but a hold is 800 ms and whichever macro wins the
/// next one turns the fly away before the A press happens. The `reached` window brings `GO SHOP`
/// back in ten brain minutes, so it is bounded rather than a loop; it is not a proof.
///
/// The purchase scripts themselves are covered by the fake-game tests
/// (`a_purchase_navigates_by_the_items_place_in_the_stock_list`), and the *stock* read is proven
/// against the cartridge below: Viridian's counter sells no Potion.
#[test] #[test]
fn go_shop_enters_the_mart_once_and_walks_to_its_counter() { fn go_shop_enters_the_mart_once_and_walks_to_its_counter() {
let rom = skip_without_rom!(); let rom = skip_without_rom!();
let Some(checkpoint) = checkpoint() else { let Some(checkpoint) = rank_eleven_checkpoint() else {
eprintln!("skipped: no FLY_TRAP_CHECKPOINT / FLY_MACRO_CHECKPOINT"); eprintln!("skipped: no FLY_RANK11_CHECKPOINT");
return; return;
}; };
let mut run = Run::resume(&rom, MacroMode::Macros, &checkpoint); let mut run = Run::resume(&rom, MacroMode::Macros, &checkpoint);
assert_eq!(run.map(), VIRIDIAN_CITY, "the checkpoint is the one the stream stalled on"); assert_eq!(run.map(), PEWTER_CITY, "the checkpoint is the town the badge was won in");
// The errand is outstanding at the checkpoint: the ledger is session state and a restore // The service is needed at the checkpoint, read from the cartridge: money, no ball, no parcel.
// starts empty (`docs/design/macros.md` section 13). // Forced hot before the first frame so that the first hold is `GO SHOP`'s, not the rotation's,
// and the burst held open: the party is hurt here too, so `GO HEAL` is on the same pads and a
// hold that fell between bursts would be the rotation's pick of the two, which walks the fly
// out of the mart to the centre.
run.force_hot = Some("macro_go_shop");
run.next_burst = 1e15;
run.frame(); run.frame();
assert!( assert!(
run.layer.bound_channels().iter().any(|channel| channel == "macro_go_shop"), run.layer.bound_channels().iter().any(|channel| channel == "macro_go_shop"),
"`GO SHOP` is on the pad with the errand outstanding: {:?}", "`GO SHOP` is on the pad with the service needed: {:?}",
run.layer.bound_channels() run.layer.bound_channels()
); );
// Into the mart, on `GO SHOP`'s own channel. Viridian is a wide city and the mart is on the // Into the mart, on `GO SHOP`'s own channel.
// far side of it, so this is several budgets' worth of walking and several holds. let mart = PEWTER_MART;
run.force_hot = Some("macro_go_shop");
let mart = u32::from(flybrain_gb::pokemon_red::maps::VIRIDIAN_MART);
run.drive_until("inside the mart", 240_000, |run| run.map() == mart); run.drive_until("inside the mart", 240_000, |run| run.map() == mart);
// Inside, `GO SHOP` is still the walk to the clerk -- the half of section 13 the ledger does // Inside, `GO SHOP` is still the walk to the clerk. Every tile beside the clerk is a wall, so
// not gate, because the errand's remaining job is to put the fly where the purchases can be // reaching one at all is the counter reach doing the work (`docs/design/macros-wram.md`
// pressed. Every tile beside the clerk is a wall, so reaching one at all is the counter reach // section 7).
// doing the work (`docs/design/macros-wram.md` section 7).
let mut shop_seen = false; let mut shop_seen = false;
let mut faced_the_counter = false; let mut faced_the_counter = false;
let mut pad_in_the_mart: Vec<String> = Vec::new(); let mut pad_in_the_mart: Vec<String> = Vec::new();
@ -2131,10 +2125,9 @@ fn go_shop_enters_the_mart_once_and_walks_to_its_counter() {
} }
let bound = run.layer.bound_channels(); let bound = run.layer.bound_channels();
let shop = bound.iter().any(|channel| channel == "macro_go_shop"); let shop = bound.iter().any(|channel| channel == "macro_go_shop");
// The frames straight after a warp report the new map with the *old* coordinates -- the // The frames straight after a warp report the new map with the *old* coordinates, so the
// header changes before the position does -- so the pad on those is dealt against a tile // pad on those is dealt against a tile of the city. Waiting for `GO SHOP` to appear is
// of the city. Waiting for `GO SHOP` to appear is waiting for the fly to actually be in // waiting for the fly to actually be in the building.
// the building.
if !shop_seen { if !shop_seen {
shop_seen = shop; shop_seen = shop;
if shop_seen { if shop_seen {
@ -2142,8 +2135,7 @@ fn go_shop_enters_the_mart_once_and_walks_to_its_counter() {
} }
return false; return false;
} }
// `GO SHOP` leaving the pad inside the building *is* the counter having been faced: the // `GO SHOP` leaving the pad inside the building *is* the counter having been faced.
// reached ledger is what retires it (`palette::counter_aims`).
faced_the_counter |= !shop; faced_the_counter |= !shop;
faced_the_counter faced_the_counter
}); });
@ -2153,25 +2145,25 @@ fn go_shop_enters_the_mart_once_and_walks_to_its_counter() {
run.money() run.money()
); );
assert!(faced_the_counter, "`GO SHOP` walked to the clerk and retired it"); assert!(faced_the_counter, "`GO SHOP` walked to the clerk and retired it");
// And while the counter was unfaced, nothing on the pad could leave the building: that is what // While the counter was unfaced, nothing on the pad could leave the building
// stops the one visit this area gets being spent on the doormat (`palette::counter_pending`). // (`palette::counter_pending`).
assert!( assert!(
!pad_in_the_mart.iter().any(|channel| channel == "macro_go_out"), !pad_in_the_mart.iter().any(|channel| channel == "macro_go_out"),
"no way out while the errand's counter is unfaced: {pad_in_the_mart:?}" "no way out while the counter is unfaced: {pad_in_the_mart:?}"
); );
// Out again -- the suppression is released now -- and the errand is paid: `GO SHOP` is not on // Out again -- the suppression is released now -- and the counter was faced, so for the
// the city's pad a second time. That is "once per area per run", and it is what makes the // reached window the service walk is not dealt from the street (row 66): that is what makes
// errand impossible to loop on. // the service impossible to ring on, though the bag still holds no ball.
run.force_hot = Some("macro_go_out"); run.force_hot = Some("macro_go_out");
run.drive_until("back out onto the city", 120_000, |run| run.map() == VIRIDIAN_CITY); run.drive_until("back out onto the town", 120_000, |run| run.map() == PEWTER_CITY);
run.force_hot = None; run.force_hot = None;
for _ in 0..600 { for _ in 0..60 {
run.frame(); run.frame();
} }
assert!( assert!(
!run.layer.bound_channels().iter().any(|channel| channel == "macro_go_shop"), !run.layer.bound_channels().iter().any(|channel| channel == "macro_go_shop"),
"the errand is paid and never offered again: {:?}", "a counter just faced is not walked back to at once: {:?}",
run.layer.bound_channels() run.layer.bound_channels()
); );
} }
@ -2195,6 +2187,10 @@ fn go_heal_enters_the_centre_and_heal_restores_the_party() {
}; };
let mut run = Run::resume(&rom, MacroMode::Macros, &checkpoint); let mut run = Run::resume(&rom, MacroMode::Macros, &checkpoint);
assert_eq!(run.map(), VIRIDIAN_CITY); assert_eq!(run.map(), VIRIDIAN_CITY);
// Forced hot *before* the first frame: the rotation's first hold is `GO OBJECTIVE`, which at
// this checkpoint (the parcel in the bag) walks to Pallet Town and Oak's lab, and the fly is
// then in another area for the rest of the budget, healing at Pewter's centre, never this one.
run.force_hot = Some("macro_go_heal");
run.frame(); run.frame();
assert!( assert!(
run.layer.bound_channels().iter().any(|channel| channel == "macro_go_heal"), run.layer.bound_channels().iter().any(|channel| channel == "macro_go_heal"),
@ -2210,7 +2206,6 @@ fn go_heal_enters_the_centre_and_heal_restores_the_party() {
let mut heal_seen = false; let mut heal_seen = false;
let mut hurt_in_centre = false; let mut hurt_in_centre = false;
let mut rested_in_centre = false; let mut rested_in_centre = false;
run.force_hot = Some("macro_go_heal");
run.drive_until("the centre's own pad", 240_000, |run| { run.drive_until("the centre's own pad", 240_000, |run| {
if run.map() != centre { if run.map() != centre {
return false; return false;