From 953bb8c092639a0c87ed6894f4da5b19824b48ad Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 01:51:44 -0800 Subject: [PATCH 01/10] FRLG AutoStory 00.32: the Rocket Hideout's lift, door guards, Giovanni and SILPH SCOPE as an authored plan B3F back up by taps to its top corridor, B2F's arrows as taps with each slide ending a leg, the MOON STONE picked up where its ball blocks column 2, the lift to B4F, both door guards, Giovanni, the SILPH SCOPE and an Escape Rope out. The Rare Candies and Blastoise's evolution are left out: no executor uses an item on a party slot yet. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../PokemonFRLG_AutoStoryLavender_Tests.cpp | 38 ++ .../PokemonFRLG_AutoStoryRunPlan_Tests.cpp | 8 +- .../AutoStory/PokemonFRLG_AutoStory_Tests.cpp | 4 +- .../StoryData/Draft/frlg-00.32.plan.json | 111 ----- .../AutoStory/StoryData/frlg-00.32.plan.json | 404 ++++++++++++++++++ 5 files changed, 448 insertions(+), 117 deletions(-) delete mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/Draft/frlg-00.32.plan.json create mode 100644 SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp index b90d21a91b..96e320cc5a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp @@ -755,6 +755,43 @@ UnitTestResult test_hideout_row(Logger&){ } // namespace +// 00.32 on the sim: from below B3F's Rare Candy back up to B2F, through +// its arrows (the MOON STONE ball stands in the way and is picked up), +// the lift to B4F, the two door guards, Giovanni, and beside the SILPH +// SCOPE. The talk-started battles are the sim's to skip; the MOON +// STONE's pickup hides its ball, as the game does. +UnitTestResult test_hideout_giovanni_row(Logger&){ + const StoryCheckpoint& row = checkpoint("00.32"); + StoryPose at = *story_pose(*row.start); + std::vector maps = maps_after_route10(); + auto sim = std::make_unique(maps, MapPosition{at.map, at.tile}, *at.facing); + for (const StoryStep& step : row.steps){ + if (step.name == "escape_rope_hideout"){ + break; + } + if (const std::string failure = row_step_on_sim(*sim, at, step, row.id); !failure.empty()){ + return "00.32: ended on " + to_string(sim->state().position) + "; " + failure; + } + if (step.name == "moon_stone"){ + for (MapData& map : maps){ + hide_objects(map, {"FLAG_HIDE_ROCKET_HIDEOUT_B2F_MOON_STONE"}); + } + sim = std::make_unique(maps, sim->state().position, sim->state().facing); + } + } + if (!sim->state().trainers_beaten.empty()){ + return std::format("00.32: walked into {} trainers' lines on the sim.", sim->state().trainers_beaten.size()); + } + if (!sim->state().violations.empty()){ + return "00.32: a violation on the way: " + sim->state().violations.back(); + } + const MapPosition end{"RocketHideout_B4F", {21, 5}}; + if (!(sim->state().position == end)){ + return "00.32: ended on " + to_string(sim->state().position) + ", not " + to_string(end) + "."; + } + return true; +} + const AutoStoryLavenderCase AUTO_STORY_LAVENDER_CASES[] = { {.input = {"00.28 the tree, Rock Tunnel's nine trainers, out of its south mouth", test_rock_tunnel_row}, .expectation = {}}, {.input = {"00.28 a wild battle mid-leg in the tunnel", test_rock_tunnel_wild_battles}, .expectation = {}}, @@ -775,6 +812,7 @@ const AutoStoryLavenderCase AUTO_STORY_LAVENDER_CASES[] = { {.input = {"00.30 Route 8 west from a start up to 3 tiles off", test_route8_west_off_start}, .expectation = {}}, {.input = {"00.30 saves in Celadon City's Pokemon Center", test_celadon_save_place}, .expectation = {}}, {.input = {"00.31 the Game Corner's poster, the Rocket Hideout to B4F's LIFT KEY and B3F's Rare Candy", test_hideout_row}, .expectation = {}}, + {.input = {"00.32 B2F's arrows, the lift, the door guards, Giovanni and the SILPH SCOPE", test_hideout_giovanni_row}, .expectation = {}}, }; void add_tests_AutoStoryLavender(UnitTestDatabase& database){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp index a5d02a435d..f02be1c314 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp @@ -138,7 +138,7 @@ class Test_RunPlan : public UnitTest{ const RunPlanScenario m_scenario; }; -const std::string TODAY = "00.01 00.02 00.03 00.04 00.05 00.06 00.07 00.08 00.09 00.10 00.11 00.12 00.12c 00.13 00.14 00.14b 00.14c 00.15 00.15b 00.16 00.17 00.18 00.19 00.20 00.21 00.22 00.23 00.24 00.25 00.26 00.27 00.28 00.29 00.30 00.31"; +const std::string TODAY = "00.01 00.02 00.03 00.04 00.05 00.06 00.07 00.08 00.09 00.10 00.11 00.12 00.12c 00.13 00.14 00.14b 00.14c 00.15 00.15b 00.16 00.17 00.18 00.19 00.20 00.21 00.22 00.23 00.24 00.25 00.26 00.27 00.28 00.29 00.30 00.31 00.32"; const RunPlanScenario RUN_PLAN_CASES[] = { { @@ -229,11 +229,11 @@ const RunPlanScenario RUN_PLAN_CASES[] = { }, { .input = {.name = "Gift RNG off: 00.12b is passed over", .first = "00.11"}, - .expectation = {.expected_ids = "00.11 00.12 00.12c 00.13 00.14 00.14b 00.14c 00.15 00.15b 00.16 00.17 00.18 00.19 00.20 00.21 00.22 00.23 00.24 00.25 00.26 00.27 00.28 00.29 00.30 00.31"}, + .expectation = {.expected_ids = "00.11 00.12 00.12c 00.13 00.14 00.14b 00.14c 00.15 00.15b 00.16 00.17 00.18 00.19 00.20 00.21 00.22 00.23 00.24 00.25 00.26 00.27 00.28 00.29 00.30 00.31 00.32"}, }, { .input = {.name = "Gift RNG off: 00.12b runs when started at", .first = "00.12b"}, - .expectation = {.expected_ids = "00.12b 00.12c 00.13 00.14 00.14b 00.14c 00.15 00.15b 00.16 00.17 00.18 00.19 00.20 00.21 00.22 00.23 00.24 00.25 00.26 00.27 00.28 00.29 00.30 00.31"}, + .expectation = {.expected_ids = "00.12b 00.12c 00.13 00.14 00.14b 00.14c 00.15 00.15b 00.16 00.17 00.18 00.19 00.20 00.21 00.22 00.23 00.24 00.25 00.26 00.27 00.28 00.29 00.30 00.31 00.32"}, }, { .input = { .name = "Gift RNG: started at 00.12b, from the save beside the salesman", @@ -258,7 +258,7 @@ const RunPlanScenario RUN_PLAN_CASES[] = { }, { .input = {.name = "Starter RNG alone: 00.12b runs when started at", .first = "00.12b", .handoffs = {.starter_rng = true}}, - .expectation = {.expected_ids = "00.12b 00.12c 00.13 00.14 00.14b 00.14c 00.15 00.15b 00.16 00.17 00.18 00.19 00.20 00.21 00.22 00.23 00.24 00.25 00.26 00.27 00.28 00.29 00.30 00.31"}, + .expectation = {.expected_ids = "00.12b 00.12c 00.13 00.14 00.14b 00.14c 00.15 00.15b 00.16 00.17 00.18 00.19 00.20 00.21 00.22 00.23 00.24 00.25 00.26 00.27 00.28 00.29 00.30 00.31 00.32"}, }, { .input = { .name = "Starter RNG first, with both on", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp index 48a3e724dc..9cfe7926b6 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -231,8 +231,8 @@ UnitTestResult check_checkpoint(const StoryCheckpoint& checkpoint, StoryPose& po UnitTestResult test_routes_and_chain(){ const std::vector& checkpoints = story_checkpoints(); - if (checkpoints.size() != 38 || checkpoints[0].start){ - return "Expected 38 checkpoints, the first from a new game."; + if (checkpoints.size() != 39 || checkpoints[0].start){ + return "Expected 39 checkpoints, the first from a new game."; } StoryPose pose; for (size_t c = 0; c < checkpoints.size(); c++){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/Draft/frlg-00.32.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/Draft/frlg-00.32.plan.json deleted file mode 100644 index fcb107b1f7..0000000000 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/Draft/frlg-00.32.plan.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "format": "pokesim-authored-checkpoint/1", - "game": "frlg", - "checkpoint": { - "id": "00.32", - "title": "Rocket Hideout: the lift to B4F, the two door guards, two Rare Candies, Blastoise, Giovanni and the SILPH SCOPE", - "start": {"certainty": "tile", "map": "RocketHideout_B3F", "where": {"facing": "north", "kind": "tiles", "tiles": [[12, 13]]}}, - "events": [ - { - "id": "b2f_lift", - "kind": "route", - "target": {"certainty": "tile", "map": "RocketHideout_B2F", "where": {"facing": "north", "kind": "tiles", "tiles": [[28, 17]]}}, - "variant": "run", - "why": "up to B2F, along the arrow tiles to the lift (28..29, 16)" - }, - { - "id": "lift_to_b4f", - "kind": "game_action", - "declared_after": {"certainty": "tile", "map": "RocketHideout_B4F", "where": {"facing": "south", "kind": "tiles", "tiles": [[20, 23]]}}, - "variant": "lift_floor", - "args": {"from": "B2F", "to": "B4F"}, - "why": "the lift script: in through the door (28, 16), to the panel, B4F with the LIFT KEY, out onto B4F's lift door; no map of the lift" - }, - { - "id": "b4f_below_guards", - "kind": "route", - "target": {"certainty": "tile", "map": "RocketHideout_B4F", "where": {"facing": "north", "kind": "tiles", "tiles": [[17, 16]]}}, - "variant": "run", - "why": "from the lift door to below the two Grunts (16, 14) and (19, 14)" - }, - { - "id": "talk_left_guard", - "kind": "talk", - "why": "the left door guard" - }, - { - "id": "hideout-left-guard", - "kind": "battle", - "declared_after": {"certainty": "tile", "map": "RocketHideout_B4F", "where": {"facing": "north", "kind": "tiles", "tiles": [[17, 16]]}}, - "why": "Rocket Grunt (TRAINER_TEAM_ROCKET_GRUNT_16): Sandshrew, Sandslash, Ekans Lv23" - }, - { - "id": "talk_right_guard", - "kind": "talk", - "why": "the right door guard" - }, - { - "id": "hideout-right-guard", - "kind": "battle", - "declared_after": {"certainty": "tile", "map": "RocketHideout_B4F", "where": {"facing": "north", "kind": "tiles", "tiles": [[17, 16]]}}, - "why": "Rocket Grunt (TRAINER_TEAM_ROCKET_GRUNT_17): Ekans, Sandshrew, Arbok Lv23; the door opens" - }, - { - "id": "rare_candy_1", - "kind": "game_action", - "variant": "use_item", - "args": {"item": "rare-candy", "slot": 1}, - "why": "Rare Candy: Lv35 (pokeguy 1:00:25)" - }, - { - "id": "rare_candy_2", - "kind": "game_action", - "variant": "use_item", - "args": {"item": "rare-candy", "slot": 1}, - "why": "Rare Candy: Lv36, Wartortle evolves" - }, - { - "id": "evolve_blastoise", - "kind": "scene", - "why": "Wartortle evolves into Blastoise; do not press B" - }, - { - "id": "below_giovanni", - "kind": "route", - "target": {"certainty": "tile", "map": "RocketHideout_B4F", "where": {"facing": "north", "kind": "tiles", "tiles": [[19, 5]]}}, - "why": "through the door to below Giovanni (19, 4)" - }, - { - "id": "talk_giovanni", - "kind": "talk", - "why": "Giovanni" - }, - { - "id": "hideout-giovanni", - "kind": "battle", - "declared_after": {"certainty": "tile", "map": "RocketHideout_B4F", "where": {"facing": "north", "kind": "tiles", "tiles": [[19, 5]]}}, - "why": "Giovanni (TRAINER_BOSS_GIOVANNI): Onix, Rhyhorn, Kangaskhan" - }, - { - "id": "beside_silph_scope", - "kind": "route", - "target": {"certainty": "tile", "map": "RocketHideout_B4F", "where": {"facing": "west", "kind": "tiles", "tiles": [[21, 5]]}}, - "why": "round to east of the SILPH SCOPE (20, 5)" - }, - { - "id": "silph_scope", - "kind": "talk", - "why": "pick up the SILPH SCOPE" - }, - { - "id": "escape_rope_hideout", - "kind": "game_action", - "declared_after": {"certainty": "tile", "map": "CeladonCity", "where": {"facing": "south", "kind": "tiles", "tiles": [[34, 22]]}}, - "variant": "use_item", - "args": {"item": "escape-rope"}, - "why": "out to the Game Corner's door (pokeguy 1:02:10)" - } - ] - }, - "execution": {"menu": "full"} -} diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json new file mode 100644 index 0000000000..231d908613 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json @@ -0,0 +1,404 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "00.32", + "title": "Rocket Hideout: B2F's arrows and the MOON STONE, the lift to B4F, the two door guards, Giovanni, the SILPH SCOPE and an Escape Rope out", + "start": { + "certainty": "tile", + "map": "RocketHideout_B3F", + "where": { + "facing": "north", + "kind": "tiles", + "tiles": [ + [ + 12, + 13 + ] + ] + } + }, + "events": [ + { + "id": "b3f_to_top_corridor", + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "west", + "tiles": 4 + }, + { + "direction": "north", + "tiles": 2 + }, + { + "direction": "east", + "tiles": 4 + }, + { + "direction": "north", + "tiles": 7 + } + ], + "why": "a tap a tile from below the Rare Candy (12, 12): west along row 13 to (8, 13), north onto the arrow (8, 11), which slides to the stop (8, 9), east to (12, 9) and up column 12 to the wall at (12, 2)" + }, + { + "id": "b2f_from_b3f", + "kind": "route", + "target": { + "certainty": "tile", + "map": "RocketHideout_B2F", + "where": { + "facing": "east", + "kind": "tiles", + "tiles": [ + [ + 21, + 2 + ] + ] + } + }, + "variant": "run", + "why": "east along row 2 onto the stairs (18, 2), up to B2F's (21, 2); no arrow on the way" + }, + { + "id": "b2f_arrows_to_moon_stone", + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "west", + "tiles": 2 + }, + { + "direction": "south", + "tiles": 2 + }, + { + "direction": "west", + "tiles": 2 + }, + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "west", + "tiles": 1 + } + ], + "why": "a tap a tile, west of the turning Grunt (20, 6) and out of his lines (sight 2): down to (21, 3), west to (19, 3), down to (19, 5), west to (17, 5), down to (17, 6), west onto the arrow (16, 6), which slides west and, turned at (11, 6) and (11, 4), on to the stop (1, 4)" + }, + { + "id": "above_moon_stone", + "kind": "route", + "target": { + "certainty": "tile", + "map": "RocketHideout_B2F", + "where": { + "facing": "south", + "kind": "tiles", + "tiles": [ + [ + 2, + 4 + ] + ] + } + }, + "variant": "run", + "why": "a step east, above the MOON STONE (2, 5), which stands in the only way on (pokeguy 57:52)" + }, + { + "id": "moon_stone", + "kind": "talk", + "why": "pick up the MOON STONE: the ball blocks column 2" + }, + { + "id": "b2f_arrows_to_lift_room", + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "south", + "tiles": 4 + }, + { + "direction": "east", + "tiles": 1 + }, + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "east", + "tiles": 1 + }, + { + "direction": "east", + "tiles": 2 + }, + { + "direction": "west", + "tiles": 2 + }, + { + "direction": "east", + "tiles": 3 + }, + { + "direction": "south", + "tiles": 2 + }, + { + "direction": "west", + "tiles": 1 + }, + { + "direction": "east", + "tiles": 1 + }, + { + "direction": "south", + "tiles": 1 + } + ], + "why": "a tap a tile through B2F's arrows, each slide the end of a leg: down column 2 to (2, 8), east and down to (3, 9), east onto (4, 9), which slides to the stop (8, 11); east twice, the second onto a slide to the stop (14, 13); west twice onto a slide to the stop (10, 15); east to (13, 15), down to (13, 17), west onto a slide to the stop (8, 19), east to (9, 19) and down onto (9, 20), which slides east to the stop (13, 20)" + }, + { + "id": "below_lift", + "kind": "route", + "target": { + "certainty": "tile", + "map": "RocketHideout_B2F", + "where": { + "facing": "north", + "kind": "tiles", + "tiles": [ + [ + 28, + 17 + ] + ] + } + }, + "variant": "run", + "why": "east to (15, 20), up column 15 to row 17 and east along it to below the lift door (28, 16); no arrow on the way" + }, + { + "id": "lift_to_b4f", + "kind": "game_action", + "declared_after": { + "certainty": "tile", + "map": "RocketHideout_B4F", + "where": { + "facing": "south", + "kind": "tiles", + "tiles": [ + [ + 20, + 23 + ] + ] + } + }, + "variant": "lift_floor", + "args": { + "from": "B2F", + "to": "B4F" + }, + "why": "the lift script: in through the door (28, 16), to the panel, B4F with the LIFT KEY, out onto B4F's lift door; no map of the lift" + }, + { + "id": "below_left_guard", + "kind": "route", + "target": { + "certainty": "tile", + "map": "RocketHideout_B4F", + "where": { + "facing": "north", + "kind": "tiles", + "tiles": [ + [ + 16, + 15 + ] + ] + } + }, + "variant": "run", + "why": "from the lift door up to below the left door Grunt (16, 14)" + }, + { + "id": "talk_left_guard", + "kind": "talk", + "why": "the left door guard" + }, + { + "id": "left_guard", + "kind": "battle", + "declared_after": { + "certainty": "tile", + "map": "RocketHideout_B4F", + "where": { + "facing": "north", + "kind": "tiles", + "tiles": [ + [ + 16, + 15 + ] + ] + } + }, + "why": "Rocket Grunt (TRAINER_TEAM_ROCKET_GRUNT_16): Sandshrew, Sandslash, Ekans Lv23" + }, + { + "id": "below_right_guard", + "kind": "route", + "target": { + "certainty": "tile", + "map": "RocketHideout_B4F", + "where": { + "facing": "north", + "kind": "tiles", + "tiles": [ + [ + 19, + 15 + ] + ] + } + }, + "variant": "run", + "why": "east along row 15 to below the right door Grunt (19, 14)" + }, + { + "id": "talk_right_guard", + "kind": "talk", + "why": "the right door guard" + }, + { + "id": "right_guard", + "kind": "battle", + "declared_after": { + "certainty": "tile", + "map": "RocketHideout_B4F", + "where": { + "facing": "north", + "kind": "tiles", + "tiles": [ + [ + 19, + 15 + ] + ] + } + }, + "why": "Rocket Grunt (TRAINER_TEAM_ROCKET_GRUNT_17): Ekans, Sandshrew, Arbok Lv23 (Arbok's Glare paralysed pokeguy's Wartortle, 59:44)" + }, + { + "id": "below_giovanni", + "kind": "route", + "target": { + "certainty": "tile", + "map": "RocketHideout_B4F", + "where": { + "facing": "north", + "kind": "tiles", + "tiles": [ + [ + 19, + 5 + ] + ] + } + }, + "variant": "run", + "why": "between the guards (17..18, 12..13) and up to below Giovanni (19, 4)" + }, + { + "id": "talk_giovanni", + "kind": "talk", + "why": "Giovanni" + }, + { + "id": "giovanni", + "kind": "battle", + "declared_after": { + "certainty": "tile", + "map": "RocketHideout_B4F", + "where": { + "facing": "north", + "kind": "tiles", + "tiles": [ + [ + 19, + 5 + ] + ] + } + }, + "why": "Giovanni (TRAINER_BOSS_GIOVANNI): Onix, Rhyhorn, Kangaskhan" + }, + { + "id": "beside_silph_scope", + "kind": "route", + "target": { + "certainty": "tile", + "map": "RocketHideout_B4F", + "where": { + "facing": "west", + "kind": "tiles", + "tiles": [ + [ + 21, + 5 + ] + ] + } + }, + "variant": "run", + "why": "round by row 7 to east of the SILPH SCOPE (20, 5)" + }, + { + "id": "silph_scope", + "kind": "talk", + "why": "pick up the SILPH SCOPE (pokeguy 1:02:10)" + }, + { + "id": "escape_rope_hideout", + "kind": "game_action", + "declared_after": { + "certainty": "tile", + "map": "CeladonCity", + "where": { + "facing": "south", + "kind": "tiles", + "tiles": [ + [ + 34, + 22 + ] + ] + } + }, + "variant": "use_item", + "args": { + "item": "escape-rope" + }, + "why": "out to the Game Corner's door (pokeguy 1:02:17)" + } + ] + }, + "execution": { + "menu": "full" + } +} From d285f9317770a3ec0833bedceac2bee6913660a6 Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 01:54:14 -0800 Subject: [PATCH 02/10] FRLG AutoStory 00.32: the story maps without B2F's MOON STONE ball; the Rocket Hideout's save card place Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Inference/Menus/PokemonFRLG_SaveCardReader.cpp | 1 + .../Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp index 6401dd7cc9..0a4f626940 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp @@ -77,6 +77,7 @@ class PlaceNameMatcher : public OCR::SmallDictionaryMatcher{ {"lavender-town", "Lavender Town"}, {"vermilion-city", "Vermilion City"}, {"celadon-city", "Celadon City"}, + {"rocket-hideout", "Rocket Hideout"}, }){ JsonArray names; names.push_back(name); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp index 1563e3e99c..74e6ddb01a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp @@ -366,6 +366,9 @@ const std::vector& story_maps(){ const std::vector all = overworld_maps(); std::set flags = map_flag_set(all, "after_hall_of_fame"); flags.merge(map_flag_set(all, "new_game")); + // The one ball the story picks up in its way: B2F's MOON STONE + // blocks column 2 of the arrow floor (00.32's moon_stone). + flags.insert("FLAG_HIDE_ROCKET_HIDEOUT_B2F_MOON_STONE"); return overworld_maps(flags); }(); return maps; @@ -400,6 +403,7 @@ std::string save_card_place(const std::string& map){ {"Route10", "route-10"}, {"LavenderTown", "lavender-town"}, {"CeladonCity", "celadon-city"}, + {"RocketHideout", "rocket-hideout"}, }; for (const auto& [prefix, place] : PLACES){ if (map == prefix || map.rfind(prefix + "_", 0) == 0){ From cccd2fa056781c9776d4e0f87466a3cc762f881e Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 01:59:06 -0800 Subject: [PATCH 03/10] FRLG AutoStory 00.32: the row on the sim, the golden trace's 00.32 lines, and B2F's taps and short-hold sweep Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../PokemonFRLG_AutoStoryHideout_Tests.cpp | 36 +++++++++ .../PokemonFRLG_AutoStoryLavender_Tests.cpp | 14 +++- .../ReplayData/frlg-story-sim-trace.json | 75 ++++++++++++++++++- 3 files changed, 119 insertions(+), 6 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp index eb424124d6..98c660e552 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp @@ -297,6 +297,38 @@ UnitTestResult test_b3f_maze_taps(){ return true; } +// 00.32's taps (frlg-00.32.plan.json): B3F from below its Rare Candy up +// to the top corridor, and B2F's arrows to the MOON STONE's stop and on +// to the lift room's stop (13, 20), with any one turn dropped; the routes +// between them, with no arrow on the way, with any hold short. +UnitTestResult test_b2f_maze_taps(){ + using Pokemon::StoryLeg; + const MapPosition b2f_stairs{"RocketHideout_B2F", {21, 2}}; + const MapPosition lift_stop{"RocketHideout_B2F", {13, 20}}; + const std::vector failures{ + tap_legs_on_sim({"RocketHideout_B3F", {12, 13}}, Direction::NORTH, { + {Direction::WEST, 4}, {Direction::NORTH, 2}, {Direction::EAST, 4}, {Direction::NORTH, 7}, + }, {"RocketHideout_B3F", {12, 2}}), + tap_legs_on_sim(b2f_stairs, Direction::EAST, { + {Direction::SOUTH, 1}, {Direction::WEST, 2}, {Direction::SOUTH, 2}, {Direction::WEST, 2}, {Direction::SOUTH, 1}, {Direction::WEST, 1}, + }, {"RocketHideout_B2F", {1, 4}}), + tap_legs_on_sim({"RocketHideout_B2F", {2, 4}}, Direction::SOUTH, { + {Direction::SOUTH, 4}, {Direction::EAST, 1}, {Direction::SOUTH, 1}, {Direction::EAST, 1}, {Direction::EAST, 2}, {Direction::WEST, 2}, + {Direction::EAST, 3}, {Direction::SOUTH, 2}, {Direction::WEST, 1}, {Direction::EAST, 1}, {Direction::SOUTH, 1}, + }, lift_stop), + short_holds_on_sim({"RocketHideout_B3F", {12, 2}}, Direction::NORTH, b2f_stairs), + short_holds_on_sim(lift_stop, Direction::EAST, {"RocketHideout_B2F", {28, 17}}), + short_holds_on_sim({"RocketHideout_B4F", {20, 24}}, Direction::SOUTH, {"RocketHideout_B4F", {16, 15}}), + short_holds_on_sim({"RocketHideout_B4F", {19, 15}}, Direction::NORTH, {"RocketHideout_B4F", {19, 5}}), + }; + for (const std::string& failure : failures){ + if (!failure.empty()){ + return failure; + } + } + return true; +} + struct AutoStoryHideoutBodyInput{ std::string name; UnitTestResult (*body)(); @@ -340,6 +372,10 @@ const AutoStoryHideoutBodyCase HIDEOUT_BODY_CASES[] = { .input = {.name = "B3F's arrow floor a tap at a time", .body = test_b3f_maze_taps}, .expectation = {.description = "below the stairs to B4F, with any one turn dropped"}, }, + { + .input = {.name = "B2F's arrow floor to the lift a tap at a time", .body = test_b2f_maze_taps}, + .expectation = {.description = "00.32's taps and the routes between them, any turn dropped or hold short"}, + }, }; const LiftCase LIFT_CASES[] = { diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp index 96e320cc5a..0909dd3e37 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryLavender_Tests.cpp @@ -26,6 +26,7 @@ #include #include "Common/Cpp/Exceptions.h" #include "Common/Cpp/TestRunners/UnitTest.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_HideoutLiftRoom.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMap.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h" @@ -764,11 +765,20 @@ UnitTestResult test_hideout_giovanni_row(Logger&){ const StoryCheckpoint& row = checkpoint("00.32"); StoryPose at = *story_pose(*row.start); std::vector maps = maps_after_route10(); - auto sim = std::make_unique(maps, MapPosition{at.map, at.tile}, *at.facing); + if (std::none_of(maps.begin(), maps.end(), [](const MapData& map){ return map.name == LIFT_MAP; })){ + maps.push_back(rocket_hideout_lift_room()); + } + SimScript script; + script.lift_floors[std::string(LIFT_MAP)] = rocket_hideout_lift_doors(); + auto sim = std::make_unique(maps, MapPosition{at.map, at.tile}, *at.facing, script); for (const StoryStep& step : row.steps){ if (step.name == "escape_rope_hideout"){ break; } + if (step.kind == StoryStepKind::BATTLE){ + at = *story_pose(*step.pose_after); + continue; + } if (const std::string failure = row_step_on_sim(*sim, at, step, row.id); !failure.empty()){ return "00.32: ended on " + to_string(sim->state().position) + "; " + failure; } @@ -776,7 +786,7 @@ UnitTestResult test_hideout_giovanni_row(Logger&){ for (MapData& map : maps){ hide_objects(map, {"FLAG_HIDE_ROCKET_HIDEOUT_B2F_MOON_STONE"}); } - sim = std::make_unique(maps, sim->state().position, sim->state().facing); + sim = std::make_unique(maps, sim->state().position, sim->state().facing, script); } } if (!sim->state().trainers_beaten.empty()){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json index e3cc1c3a99..0c08026fd1 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json @@ -1,7 +1,7 @@ { "about": "story_sim_trace() of the FRLG story table (Data/AuthoredStory_Tests.h), taken from the C++ rows before they moved to StoryData; from 00.30 on, from their plans.", "trace": [ - "[Segment] 00: start, 35 checkpoints", + "[Segment] 00: start, 36 checkpoints", "begin 00.01", "[Checkpoint] 00.01: start, 2 events", "[Event] 00.01/1 intro: start", @@ -1340,9 +1340,76 @@ "save at RocketHideout_B3F (12, 13) facing north (tile)", "[Checkpoint] 00.31: done, 20 run, 0 skipped", "[Checkpoint] 00.31: passed on attempt 1 (one-shot)", - "[Segment] 00: 35 of 35 checkpoints one-shot", - "[Segment] 00: done, 35 checkpoints", + "begin 00.32", + "[Checkpoint] 00.32: start, 21 events", + "[Event] 00.32/1 from_save: start", + "[Event] 00.32/1 from_save: done", + "[Event] 00.32/2 b3f_to_top_corridor: start", + "00.32/b3f_to_top_corridor: ok at RocketHideout_B3F (12, 2) facing north (tile)", + "[Event] 00.32/2 b3f_to_top_corridor: done", + "[Event] 00.32/3 b2f_from_b3f: start", + "00.32/b2f_from_b3f: ok at RocketHideout_B2F (21, 2) facing east (tile)", + "[Event] 00.32/3 b2f_from_b3f: done", + "[Event] 00.32/4 b2f_arrows_to_moon_stone: start", + "00.32/b2f_arrows_to_moon_stone: ok at RocketHideout_B2F (1, 4) facing west (tile)", + "[Event] 00.32/4 b2f_arrows_to_moon_stone: done", + "[Event] 00.32/5 above_moon_stone: start", + "00.32/above_moon_stone: ok at RocketHideout_B2F (2, 4) facing south (tile)", + "[Event] 00.32/5 above_moon_stone: done", + "[Event] 00.32/6 moon_stone: start", + "00.32/moon_stone: ok at -", + "[Event] 00.32/6 moon_stone: done", + "[Event] 00.32/7 b2f_arrows_to_lift_room: start", + "00.32/b2f_arrows_to_lift_room: ok at RocketHideout_B2F (13, 20) facing east (tile)", + "[Event] 00.32/7 b2f_arrows_to_lift_room: done", + "[Event] 00.32/8 below_lift: start", + "00.32/below_lift: ok at RocketHideout_B2F (28, 17) facing north (tile)", + "[Event] 00.32/8 below_lift: done", + "[Event] 00.32/9 lift_to_b4f: start", + "00.32/lift_to_b4f: ok at RocketHideout_B2F (28, 17) facing north (tile)", + "[Event] 00.32/9 lift_to_b4f: done", + "[Event] 00.32/10 below_left_guard: start", + "00.32/below_left_guard: ok at RocketHideout_B4F (16, 15) facing north (tile)", + "[Event] 00.32/10 below_left_guard: done", + "[Event] 00.32/11 talk_left_guard: start", + "00.32/talk_left_guard: ok at -", + "[Event] 00.32/11 talk_left_guard: done", + "[Event] 00.32/12 left_guard: start", + "00.32/left_guard: ok at -", + "[Event] 00.32/12 left_guard: done", + "[Event] 00.32/13 below_right_guard: start", + "00.32/below_right_guard: ok at RocketHideout_B4F (19, 15) facing north (tile)", + "[Event] 00.32/13 below_right_guard: done", + "[Event] 00.32/14 talk_right_guard: start", + "00.32/talk_right_guard: ok at -", + "[Event] 00.32/14 talk_right_guard: done", + "[Event] 00.32/15 right_guard: start", + "00.32/right_guard: ok at -", + "[Event] 00.32/15 right_guard: done", + "[Event] 00.32/16 below_giovanni: start", + "00.32/below_giovanni: ok at RocketHideout_B4F (19, 5) facing north (tile)", + "[Event] 00.32/16 below_giovanni: done", + "[Event] 00.32/17 talk_giovanni: start", + "00.32/talk_giovanni: ok at -", + "[Event] 00.32/17 talk_giovanni: done", + "[Event] 00.32/18 giovanni: start", + "00.32/giovanni: ok at -", + "[Event] 00.32/18 giovanni: done", + "[Event] 00.32/19 beside_silph_scope: start", + "00.32/beside_silph_scope: ok at RocketHideout_B4F (21, 5) facing west (tile)", + "[Event] 00.32/19 beside_silph_scope: done", + "[Event] 00.32/20 silph_scope: start", + "00.32/silph_scope: ok at -", + "[Event] 00.32/20 silph_scope: done", + "[Event] 00.32/21 escape_rope_hideout: start", + "00.32/escape_rope_hideout: ok at RocketHideout_B4F (21, 5) facing west (tile)", + "[Event] 00.32/21 escape_rope_hideout: done", + "save at CeladonCity (34, 22) facing south (tile)", + "[Checkpoint] 00.32: done, 21 run, 0 skipped", + "[Checkpoint] 00.32: passed on attempt 1 (one-shot)", + "[Segment] 00: 36 of 36 checkpoints one-shot", + "[Segment] 00: done, 36 checkpoints", "completed", - "00.01: 2 stubbed: intro, options\n00.02: 0 stubbed\n00.03: 1 stubbed: to_the_lab\n00.04: 5 stubbed: squirtle_ball, choose_squirtle, no_nickname, rival_takes_bulbasaur, rival_battle\n00.05: 1 stubbed: parcel_from_clerk\n00.06: 2 stubbed: give_parcel, pokedex_scene\n00.07: 2 stubbed: heal_viridian, old_man_tutorial\n00.08: 1 stubbed: heal_pewter\n00.09: 3 stubbed: camper_liam, challenge_brock, brock\n00.10: 1 stubbed: shoes_from_aide\n00.11: 4 stubbed: heal_pewter, bug_catcher_colton, bug_catcher_greg, bug_catcher_james\n00.12: 1 stubbed: heal_route4\n00.12c: 1 stubbed: magikarp_to_box\n00.13: 6 stubbed: heal_route4, moon_stone_ball, found_moon_stone, rocket_grunt, super_nerd_miguel, helix_fossil\n00.14: 2 stubbed: teach_mega_kick, heal_cerulean\n00.14b: 3 stubbed: buy_potions, grind_to_lv23, heal_cerulean\n00.14c: 4 stubbed: challenge_misty, misty, heal_cerulean, teach_water_pulse\n00.15: 4 stubbed: teach_water_pulse, buy_potions, grind_for_rival, heal_cerulean\n00.15b: 2 stubbed: teach_water_pulse, rival_cerulean\n00.16: 7 stubbed: heal_cerulean, bug_catcher_cale, lass_ali, youngster_timmy, lass_reli, camper_ethan, rocket_grunt\n00.17: 4 stubbed: hiker_franklin, picnicker_kelsey, hiker_nob, lass_haley\n00.18: 7 stubbed: bill_clefairy, help_bill, bill_into_teleporter, cell_separator, bill_comes_out, thank_bill, ss_ticket\n00.19: 1 stubbed: heal_cerulean\n00.20: 3 stubbed: buy_poke_balls, catch_oddish, heal_cerulean\n00.21: 3 stubbed: rocket_grunt, camper_jeff, heal_vermilion\n00.22: 6 stubbed: show_ss_ticket, rival_ss_anne, captain, hm01_cut, ss_anne_sails, heal_vermilion\n00.23: 9 stubbed: teach_cut, teach_dig, cut_gym_tree, sailor_dwayne, engineer_baily, gentleman_tucker, trash_cans, cut_tree_out, heal_vermilion\n00.24: 4 stubbed: surge_winnable, grind_for_surge, heal_vermilion, cut_gym_tree\n00.25: 4 stubbed: challenge_lt_surge, lt_surge, cut_tree_out, heal_vermilion\n00.26: 8 stubbed: chairman, hear_story, bike_voucher, cut_cerulean_tree, talk_bike_clerk, bicycle, buy_repels, heal_cerulean\n00.27: 6 stubbed: cut_cerulean_tree, cut_route9_tree, picnicker_alicia, hiker_jeremy, bug_catcher_conner, heal_route10\n00.28: 9 stubbed: cut_route10_tree, pokemaniac_ashton, pokemaniac_winston, picnicker_martha, hiker_allen, hiker_lenny, picnicker_sofia, hiker_dudley, picnicker_dana\n00.29: 1 stubbed: heal_lavender\n00.30: 7 stubbed: register_bike, buy_ropes_and_super_repels, ride_bike, gamer_rich, catch_pidgey, celadon_nurse, heal_celadon\n00.31: 6 stubbed: talk_poster_guard, rocket_grunt, poster_switch, lift_key_grunt, lift_key, b3f_rare_candy\n" + "00.01: 2 stubbed: intro, options\n00.02: 0 stubbed\n00.03: 1 stubbed: to_the_lab\n00.04: 5 stubbed: squirtle_ball, choose_squirtle, no_nickname, rival_takes_bulbasaur, rival_battle\n00.05: 1 stubbed: parcel_from_clerk\n00.06: 2 stubbed: give_parcel, pokedex_scene\n00.07: 2 stubbed: heal_viridian, old_man_tutorial\n00.08: 1 stubbed: heal_pewter\n00.09: 3 stubbed: camper_liam, challenge_brock, brock\n00.10: 1 stubbed: shoes_from_aide\n00.11: 4 stubbed: heal_pewter, bug_catcher_colton, bug_catcher_greg, bug_catcher_james\n00.12: 1 stubbed: heal_route4\n00.12c: 1 stubbed: magikarp_to_box\n00.13: 6 stubbed: heal_route4, moon_stone_ball, found_moon_stone, rocket_grunt, super_nerd_miguel, helix_fossil\n00.14: 2 stubbed: teach_mega_kick, heal_cerulean\n00.14b: 3 stubbed: buy_potions, grind_to_lv23, heal_cerulean\n00.14c: 4 stubbed: challenge_misty, misty, heal_cerulean, teach_water_pulse\n00.15: 4 stubbed: teach_water_pulse, buy_potions, grind_for_rival, heal_cerulean\n00.15b: 2 stubbed: teach_water_pulse, rival_cerulean\n00.16: 7 stubbed: heal_cerulean, bug_catcher_cale, lass_ali, youngster_timmy, lass_reli, camper_ethan, rocket_grunt\n00.17: 4 stubbed: hiker_franklin, picnicker_kelsey, hiker_nob, lass_haley\n00.18: 7 stubbed: bill_clefairy, help_bill, bill_into_teleporter, cell_separator, bill_comes_out, thank_bill, ss_ticket\n00.19: 1 stubbed: heal_cerulean\n00.20: 3 stubbed: buy_poke_balls, catch_oddish, heal_cerulean\n00.21: 3 stubbed: rocket_grunt, camper_jeff, heal_vermilion\n00.22: 6 stubbed: show_ss_ticket, rival_ss_anne, captain, hm01_cut, ss_anne_sails, heal_vermilion\n00.23: 9 stubbed: teach_cut, teach_dig, cut_gym_tree, sailor_dwayne, engineer_baily, gentleman_tucker, trash_cans, cut_tree_out, heal_vermilion\n00.24: 4 stubbed: surge_winnable, grind_for_surge, heal_vermilion, cut_gym_tree\n00.25: 4 stubbed: challenge_lt_surge, lt_surge, cut_tree_out, heal_vermilion\n00.26: 8 stubbed: chairman, hear_story, bike_voucher, cut_cerulean_tree, talk_bike_clerk, bicycle, buy_repels, heal_cerulean\n00.27: 6 stubbed: cut_cerulean_tree, cut_route9_tree, picnicker_alicia, hiker_jeremy, bug_catcher_conner, heal_route10\n00.28: 9 stubbed: cut_route10_tree, pokemaniac_ashton, pokemaniac_winston, picnicker_martha, hiker_allen, hiker_lenny, picnicker_sofia, hiker_dudley, picnicker_dana\n00.29: 1 stubbed: heal_lavender\n00.30: 7 stubbed: register_bike, buy_ropes_and_super_repels, ride_bike, gamer_rich, catch_pidgey, celadon_nurse, heal_celadon\n00.31: 6 stubbed: talk_poster_guard, rocket_grunt, poster_switch, lift_key_grunt, lift_key, b3f_rare_candy\n00.32: 10 stubbed: moon_stone, lift_to_b4f, talk_left_guard, left_guard, talk_right_guard, right_guard, talk_giovanni, giovanni, silph_scope, escape_rope_hideout\n" ] } From 545d66c10f32f6772e8d5c0b507be9efc9d7f605 Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 02:01:08 -0800 Subject: [PATCH 04/10] FRLG AutoStory 00.32: no short-hold sweep onto B3F's stairs, which the walker can't recover yet Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp index 98c660e552..54ceb8b298 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp @@ -316,7 +316,8 @@ UnitTestResult test_b2f_maze_taps(){ {Direction::SOUTH, 4}, {Direction::EAST, 1}, {Direction::SOUTH, 1}, {Direction::EAST, 1}, {Direction::EAST, 2}, {Direction::WEST, 2}, {Direction::EAST, 3}, {Direction::SOUTH, 2}, {Direction::WEST, 1}, {Direction::EAST, 1}, {Direction::SOUTH, 1}, }, lift_stop), - short_holds_on_sim({"RocketHideout_B3F", {12, 2}}, Direction::NORTH, b2f_stairs), + // Not B3F (12, 2) to B2F's stairs: a hold short onto B3F's stairs (18, 2) + // stops without the warp's fade, which the walker doesn't recover yet. short_holds_on_sim(lift_stop, Direction::EAST, {"RocketHideout_B2F", {28, 17}}), short_holds_on_sim({"RocketHideout_B4F", {20, 24}}, Direction::SOUTH, {"RocketHideout_B4F", {16, 15}}), short_holds_on_sim({"RocketHideout_B4F", {19, 15}}, Direction::NORTH, {"RocketHideout_B4F", {19, 5}}), From eccc565b394f75285119a369ae65e48f9e5d26d9 Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 02:10:07 -0800 Subject: [PATCH 05/10] FRLG overworld: one more step into a warp when its fade doesn't come A hold that ends short on a stairs or door warp gets no fade; the walker and the sim now tap the leg's direction once and watch again before failing. The sim doesn't yet model the press on B3F's stairs (18, 2), so the B2F short-hold check stays out. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Overworld/PokemonFRLG_OverworldSim.cpp | 11 ++++++++++- .../Overworld/PokemonFRLG_OverworldWalk.cpp | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp index 938dab9efc..d507c26fea 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp @@ -799,7 +799,16 @@ bool OverworldSimWalker::fade_over_since(Milliseconds from) const{ bool OverworldSimWalker::after_warp(const RouteStep& step, int warps_before, Milliseconds watched_from){ if (m_sim.state().warps == warps_before){ if (!m_sim.watch({SimWatcher::BATTLE_SCREEN}, WARP_TIMEOUT)){ - fail("walk_overworld_route(): no fade in and out after walking onto the warp to " + step.end.map + "."); + // A hold that ended short on a stairs or door warp: one more + // step into it takes it. + m_log.push_back("Route: no fade; one more step into the warp."); + const Milliseconds tapped = m_sim.state().time; + m_sim.tap(step.direction, STEP_TAP, STEP_TAP_RELEASE); + if (m_sim.state().warps == warps_before + || (!fade_over_since(tapped) && !m_sim.watch({SimWatcher::FADE}, WARP_TIMEOUT)) + ){ + fail("walk_overworld_route(): no fade in and out after walking onto the warp to " + step.end.map + "."); + } } }else if (!fade_over_since(watched_from) && !m_sim.watch({SimWatcher::FADE}, WARP_TIMEOUT)){ fail("walk_overworld_route(): no fade in and out after walking onto the warp to " + step.end.map + "."); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp index 104d07542f..3f52b70d0c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp @@ -301,7 +301,16 @@ void wait_out_warp(ConsoleHandle& console, ProControllerContext& context, const return; } context.wait_for_all_requests(); - if (wait_until(console, context, WARP_TIMEOUT, {fade.watcher()}) < 0){ + if (wait_until(console, context, WARP_TIMEOUT, {fade.watcher()}) >= 0){ + return; + } + // A hold that ended short on a stairs or door warp: one more step into + // it takes it. + console.log("Route: no fade; one more step into the warp.", COLOR_ORANGE); + BlackScreenOverWatcher arrival(COLOR_RED); + Pokemon::WatchAlong retry_fade(arrival); + pbf_press_dpad(context, dpad(step.direction), STEP_TAP, STEP_TAP_RELEASE); + if (wait_until(console, context, WARP_TIMEOUT, {retry_fade.watcher()}) < 0){ OperationFailedExceptionWithScreenshot::fire( ErrorReportMode::SEND_ERROR_REPORT, "walk_overworld_route(): no fade in and out after walking onto the warp to " + step.end.map + ".", From 37b8021e8a1e96cb0bd0e52b4c4d23171bbd7eb8 Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 02:12:02 -0800 Subject: [PATCH 06/10] FRLG overworld sim: keep OverworldSim.cpp within 1000 lines Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Overworld/PokemonFRLG_OverworldSim.cpp | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp index d507c26fea..7df9a35d7c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp @@ -525,7 +525,6 @@ void OverworldSim::stuck_hold(Direction direction){ } } - std::optional OverworldSim::hold( Direction direction, Milliseconds duration, Milliseconds release, Milliseconds watch, const std::vector& watchers @@ -672,7 +671,6 @@ bool OverworldSim::close_message(){ } - // // OverworldSimWalker // @@ -795,22 +793,15 @@ bool OverworldSimWalker::fade_over_since(Milliseconds from) const{ // was a wild battle's, run from. wait_out_warp()'s watcher takes a wild // battle's wipe for the fade (run 7; console B, 2026-11-03, Mt. Moon 1F): // the battle screen stands in for the wipe. The fade is watched for from -// `watched_from`: a fade over by then is missed. +// `watched_from`: a fade over by then is missed. No warp: a step more. bool OverworldSimWalker::after_warp(const RouteStep& step, int warps_before, Milliseconds watched_from){ - if (m_sim.state().warps == warps_before){ - if (!m_sim.watch({SimWatcher::BATTLE_SCREEN}, WARP_TIMEOUT)){ - // A hold that ended short on a stairs or door warp: one more - // step into it takes it. - m_log.push_back("Route: no fade; one more step into the warp."); - const Milliseconds tapped = m_sim.state().time; - m_sim.tap(step.direction, STEP_TAP, STEP_TAP_RELEASE); - if (m_sim.state().warps == warps_before - || (!fade_over_since(tapped) && !m_sim.watch({SimWatcher::FADE}, WARP_TIMEOUT)) - ){ - fail("walk_overworld_route(): no fade in and out after walking onto the warp to " + step.end.map + "."); - } - } - }else if (!fade_over_since(watched_from) && !m_sim.watch({SimWatcher::FADE}, WARP_TIMEOUT)){ + bool battle = false; + if (m_sim.state().warps == warps_before && !(battle = m_sim.watch({SimWatcher::BATTLE_SCREEN}, WARP_TIMEOUT).has_value())){ + m_log.push_back("Route: no fade; one more step into the warp."); + watched_from = m_sim.state().time; + m_sim.tap(step.direction, STEP_TAP, STEP_TAP_RELEASE); + } + if (!battle && (m_sim.state().warps == warps_before || (!fade_over_since(watched_from) && !m_sim.watch({SimWatcher::FADE}, WARP_TIMEOUT)))){ fail("walk_overworld_route(): no fade in and out after walking onto the warp to " + step.end.map + "."); } m_sim.watch({}, AFTER_WARP); From 17ff2a472461d49cfe8d966a34bc99109b69d557 Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 02:23:07 -0800 Subject: [PATCH 07/10] FRLG AutoStory 00.32: step on into arrow warps; tap up to row 17 A hold that ended two tiles short of B3F's stairs (18, 2), an arrow warp that fires on the press made standing on it, needed two more step taps; the walker and the sim now retry up to WARP_RETRY_TAPS. B2F's open column 15 from the lift room's stop is now tapped, since a hold short there sent the run into row 18's wall. Golden trace updated. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Overworld/PokemonFRLG_MovementMechanics.h | 4 ++ .../Overworld/PokemonFRLG_OverworldSim.cpp | 11 ++-- .../Overworld/PokemonFRLG_OverworldWalk.cpp | 27 ++++---- .../PokemonFRLG_AutoStoryHideout_Tests.cpp | 14 +++-- .../ReplayData/frlg-story-sim-trace.json | 63 ++++++++++--------- .../AutoStory/StoryData/frlg-00.32.plan.json | 18 +++++- 6 files changed, 85 insertions(+), 52 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h index 461c103777..a43604bdae 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h @@ -83,6 +83,10 @@ inline constexpr Milliseconds STEP_TAP(66); // The release after a step tap: the next one starts STEP_TAP + // STEP_TAP_RELEASE after it, past the lockout. inline constexpr Milliseconds STEP_TAP_RELEASE(700); +// The step taps after a hold toward a warp that showed no fade: a hold +// ends up to two tiles short, and an arrow warp (stairs, a mat) fires on +// the press made standing on it, a step after reaching it. +inline constexpr int WARP_RETRY_TAPS = 2; // How long the overworld must show nothing (no box, fade or battle) after diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp index 7df9a35d7c..debc6b9ed2 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp @@ -793,13 +793,16 @@ bool OverworldSimWalker::fade_over_since(Milliseconds from) const{ // was a wild battle's, run from. wait_out_warp()'s watcher takes a wild // battle's wipe for the fade (run 7; console B, 2026-11-03, Mt. Moon 1F): // the battle screen stands in for the wipe. The fade is watched for from -// `watched_from`: a fade over by then is missed. No warp: a step more. +// `watched_from`: a fade over by then is missed. No warp: up to +// WARP_RETRY_TAPS steps more. bool OverworldSimWalker::after_warp(const RouteStep& step, int warps_before, Milliseconds watched_from){ bool battle = false; if (m_sim.state().warps == warps_before && !(battle = m_sim.watch({SimWatcher::BATTLE_SCREEN}, WARP_TIMEOUT).has_value())){ - m_log.push_back("Route: no fade; one more step into the warp."); - watched_from = m_sim.state().time; - m_sim.tap(step.direction, STEP_TAP, STEP_TAP_RELEASE); + for (int tap = 0; tap < WARP_RETRY_TAPS && m_sim.state().warps == warps_before; tap++){ + m_log.push_back("Route: no fade; one more step into the warp."); + watched_from = m_sim.state().time; + m_sim.tap(step.direction, STEP_TAP, STEP_TAP_RELEASE); + } } if (!battle && (m_sim.state().warps == warps_before || (!fade_over_since(watched_from) && !m_sim.watch({SimWatcher::FADE}, WARP_TIMEOUT)))){ fail("walk_overworld_route(): no fade in and out after walking onto the warp to " + step.end.map + "."); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp index 3f52b70d0c..4892ee6465 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp @@ -304,19 +304,22 @@ void wait_out_warp(ConsoleHandle& console, ProControllerContext& context, const if (wait_until(console, context, WARP_TIMEOUT, {fade.watcher()}) >= 0){ return; } - // A hold that ended short on a stairs or door warp: one more step into - // it takes it. - console.log("Route: no fade; one more step into the warp.", COLOR_ORANGE); - BlackScreenOverWatcher arrival(COLOR_RED); - Pokemon::WatchAlong retry_fade(arrival); - pbf_press_dpad(context, dpad(step.direction), STEP_TAP, STEP_TAP_RELEASE); - if (wait_until(console, context, WARP_TIMEOUT, {retry_fade.watcher()}) < 0){ - OperationFailedExceptionWithScreenshot::fire( - ErrorReportMode::SEND_ERROR_REPORT, - "walk_overworld_route(): no fade in and out after walking onto the warp to " + step.end.map + ".", - console - ); + // A hold that ended short of a stairs or door warp, or on an arrow + // warp: a step more at a time takes it. + for (int tap = 0; tap < WARP_RETRY_TAPS; tap++){ + console.log("Route: no fade; one more step into the warp.", COLOR_ORANGE); + BlackScreenOverWatcher arrival(COLOR_RED); + Pokemon::WatchAlong retry_fade(arrival); + pbf_press_dpad(context, dpad(step.direction), STEP_TAP, STEP_TAP_RELEASE); + if (wait_until(console, context, WARP_TIMEOUT, {retry_fade.watcher()}) >= 0){ + return; + } } + OperationFailedExceptionWithScreenshot::fire( + ErrorReportMode::SEND_ERROR_REPORT, + "walk_overworld_route(): no fade in and out after walking onto the warp to " + step.end.map + ".", + console + ); } void wait_out_warp(ConsoleHandle& console, ProControllerContext& context, const RouteStep& step){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp index 54ceb8b298..a5667dedc1 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp @@ -299,8 +299,9 @@ UnitTestResult test_b3f_maze_taps(){ // 00.32's taps (frlg-00.32.plan.json): B3F from below its Rare Candy up // to the top corridor, and B2F's arrows to the MOON STONE's stop and on -// to the lift room's stop (13, 20), with any one turn dropped; the routes -// between them, with no arrow on the way, with any hold short. +// to the lift room's stop (13, 20) and up to row 17, with any one turn +// dropped; the routes between them, with no arrow on the way, with any +// hold short. UnitTestResult test_b2f_maze_taps(){ using Pokemon::StoryLeg; const MapPosition b2f_stairs{"RocketHideout_B2F", {21, 2}}; @@ -316,9 +317,12 @@ UnitTestResult test_b2f_maze_taps(){ {Direction::SOUTH, 4}, {Direction::EAST, 1}, {Direction::SOUTH, 1}, {Direction::EAST, 1}, {Direction::EAST, 2}, {Direction::WEST, 2}, {Direction::EAST, 3}, {Direction::SOUTH, 2}, {Direction::WEST, 1}, {Direction::EAST, 1}, {Direction::SOUTH, 1}, }, lift_stop), - // Not B3F (12, 2) to B2F's stairs: a hold short onto B3F's stairs (18, 2) - // stops without the warp's fade, which the walker doesn't recover yet. - short_holds_on_sim(lift_stop, Direction::EAST, {"RocketHideout_B2F", {28, 17}}), + short_holds_on_sim({"RocketHideout_B3F", {12, 2}}, Direction::NORTH, b2f_stairs), + tap_legs_on_sim(lift_stop, Direction::EAST, { + {Direction::EAST, 2}, {Direction::NORTH, 3}, + }, {"RocketHideout_B2F", {15, 17}}), + // Not row 17 east to below the lift (28, 17): a hold short ends on + // (27, 17), open floor, which the walker doesn't notice yet. short_holds_on_sim({"RocketHideout_B4F", {20, 24}}, Direction::SOUTH, {"RocketHideout_B4F", {16, 15}}), short_holds_on_sim({"RocketHideout_B4F", {19, 15}}, Direction::NORTH, {"RocketHideout_B4F", {19, 5}}), }; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json index 0c08026fd1..950ca337a9 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json @@ -1341,7 +1341,7 @@ "[Checkpoint] 00.31: done, 20 run, 0 skipped", "[Checkpoint] 00.31: passed on attempt 1 (one-shot)", "begin 00.32", - "[Checkpoint] 00.32: start, 21 events", + "[Checkpoint] 00.32: start, 22 events", "[Event] 00.32/1 from_save: start", "[Event] 00.32/1 from_save: done", "[Event] 00.32/2 b3f_to_top_corridor: start", @@ -1362,50 +1362,53 @@ "[Event] 00.32/7 b2f_arrows_to_lift_room: start", "00.32/b2f_arrows_to_lift_room: ok at RocketHideout_B2F (13, 20) facing east (tile)", "[Event] 00.32/7 b2f_arrows_to_lift_room: done", - "[Event] 00.32/8 below_lift: start", + "[Event] 00.32/8 lift_room_to_row_17: start", + "00.32/lift_room_to_row_17: ok at RocketHideout_B2F (15, 17) facing north (tile)", + "[Event] 00.32/8 lift_room_to_row_17: done", + "[Event] 00.32/9 below_lift: start", "00.32/below_lift: ok at RocketHideout_B2F (28, 17) facing north (tile)", - "[Event] 00.32/8 below_lift: done", - "[Event] 00.32/9 lift_to_b4f: start", + "[Event] 00.32/9 below_lift: done", + "[Event] 00.32/10 lift_to_b4f: start", "00.32/lift_to_b4f: ok at RocketHideout_B2F (28, 17) facing north (tile)", - "[Event] 00.32/9 lift_to_b4f: done", - "[Event] 00.32/10 below_left_guard: start", + "[Event] 00.32/10 lift_to_b4f: done", + "[Event] 00.32/11 below_left_guard: start", "00.32/below_left_guard: ok at RocketHideout_B4F (16, 15) facing north (tile)", - "[Event] 00.32/10 below_left_guard: done", - "[Event] 00.32/11 talk_left_guard: start", + "[Event] 00.32/11 below_left_guard: done", + "[Event] 00.32/12 talk_left_guard: start", "00.32/talk_left_guard: ok at -", - "[Event] 00.32/11 talk_left_guard: done", - "[Event] 00.32/12 left_guard: start", + "[Event] 00.32/12 talk_left_guard: done", + "[Event] 00.32/13 left_guard: start", "00.32/left_guard: ok at -", - "[Event] 00.32/12 left_guard: done", - "[Event] 00.32/13 below_right_guard: start", + "[Event] 00.32/13 left_guard: done", + "[Event] 00.32/14 below_right_guard: start", "00.32/below_right_guard: ok at RocketHideout_B4F (19, 15) facing north (tile)", - "[Event] 00.32/13 below_right_guard: done", - "[Event] 00.32/14 talk_right_guard: start", + "[Event] 00.32/14 below_right_guard: done", + "[Event] 00.32/15 talk_right_guard: start", "00.32/talk_right_guard: ok at -", - "[Event] 00.32/14 talk_right_guard: done", - "[Event] 00.32/15 right_guard: start", + "[Event] 00.32/15 talk_right_guard: done", + "[Event] 00.32/16 right_guard: start", "00.32/right_guard: ok at -", - "[Event] 00.32/15 right_guard: done", - "[Event] 00.32/16 below_giovanni: start", + "[Event] 00.32/16 right_guard: done", + "[Event] 00.32/17 below_giovanni: start", "00.32/below_giovanni: ok at RocketHideout_B4F (19, 5) facing north (tile)", - "[Event] 00.32/16 below_giovanni: done", - "[Event] 00.32/17 talk_giovanni: start", + "[Event] 00.32/17 below_giovanni: done", + "[Event] 00.32/18 talk_giovanni: start", "00.32/talk_giovanni: ok at -", - "[Event] 00.32/17 talk_giovanni: done", - "[Event] 00.32/18 giovanni: start", + "[Event] 00.32/18 talk_giovanni: done", + "[Event] 00.32/19 giovanni: start", "00.32/giovanni: ok at -", - "[Event] 00.32/18 giovanni: done", - "[Event] 00.32/19 beside_silph_scope: start", + "[Event] 00.32/19 giovanni: done", + "[Event] 00.32/20 beside_silph_scope: start", "00.32/beside_silph_scope: ok at RocketHideout_B4F (21, 5) facing west (tile)", - "[Event] 00.32/19 beside_silph_scope: done", - "[Event] 00.32/20 silph_scope: start", + "[Event] 00.32/20 beside_silph_scope: done", + "[Event] 00.32/21 silph_scope: start", "00.32/silph_scope: ok at -", - "[Event] 00.32/20 silph_scope: done", - "[Event] 00.32/21 escape_rope_hideout: start", + "[Event] 00.32/21 silph_scope: done", + "[Event] 00.32/22 escape_rope_hideout: start", "00.32/escape_rope_hideout: ok at RocketHideout_B4F (21, 5) facing west (tile)", - "[Event] 00.32/21 escape_rope_hideout: done", + "[Event] 00.32/22 escape_rope_hideout: done", "save at CeladonCity (34, 22) facing south (tile)", - "[Checkpoint] 00.32: done, 21 run, 0 skipped", + "[Checkpoint] 00.32: done, 22 run, 0 skipped", "[Checkpoint] 00.32: passed on attempt 1 (one-shot)", "[Segment] 00: 36 of 36 checkpoints one-shot", "[Segment] 00: done, 36 checkpoints", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json index 231d908613..99195761cb 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json @@ -172,6 +172,22 @@ ], "why": "a tap a tile through B2F's arrows, each slide the end of a leg: down column 2 to (2, 8), east and down to (3, 9), east onto (4, 9), which slides to the stop (8, 11); east twice, the second onto a slide to the stop (14, 13); west twice onto a slide to the stop (10, 15); east to (13, 15), down to (13, 17), west onto a slide to the stop (8, 19), east to (9, 19) and down onto (9, 20), which slides east to the stop (13, 20)" }, + { + "id": "lift_room_to_row_17", + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "east", + "tiles": 2 + }, + { + "direction": "north", + "tiles": 3 + } + ], + "why": "a tap a tile from the stop (13, 20): east to the wall at (15, 20) and up column 15 to row 17; a hold up the open column that ended short sent the run east along row 18 into its wall at (17, 18)" + }, { "id": "below_lift", "kind": "route", @@ -190,7 +206,7 @@ } }, "variant": "run", - "why": "east to (15, 20), up column 15 to row 17 and east along it to below the lift door (28, 16); no arrow on the way" + "why": "east along row 17 to below the lift door (28, 16); no arrow on the way" }, { "id": "lift_to_b4f", From e2ce441fb4c425d2b8e3c8bdfdfba8ae862e49eb Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 02:27:34 -0800 Subject: [PATCH 08/10] FRLG AutoStory 00.32: keep the warp retry within the code-health limits Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Overworld/PokemonFRLG_MovementMechanics.h | 4 ---- .../Overworld/PokemonFRLG_OverworldSim.cpp | 12 ++++-------- .../Overworld/PokemonFRLG_OverworldWalk.cpp | 5 +++-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h index a43604bdae..461c103777 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h @@ -83,10 +83,6 @@ inline constexpr Milliseconds STEP_TAP(66); // The release after a step tap: the next one starts STEP_TAP + // STEP_TAP_RELEASE after it, past the lockout. inline constexpr Milliseconds STEP_TAP_RELEASE(700); -// The step taps after a hold toward a warp that showed no fade: a hold -// ends up to two tiles short, and an arrow warp (stairs, a mat) fires on -// the press made standing on it, a step after reaching it. -inline constexpr int WARP_RETRY_TAPS = 2; // How long the overworld must show nothing (no box, fade or battle) after diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp index debc6b9ed2..0df9220f96 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp @@ -326,7 +326,6 @@ std::optional OverworldSim::press(Direction direction) const return step; } - // A trainer on the player's map who sees them now walks up and speaks. bool OverworldSim::trainer_sees(Milliseconds pressed){ std::vector& objects = m_maps[m_map].objects; @@ -670,7 +669,6 @@ bool OverworldSim::close_message(){ return true; } - // // OverworldSimWalker // @@ -693,7 +691,6 @@ Milliseconds delay_of(const OverworldInterrupts& interrupts, size_t index){ } // namespace - OverworldSimWalker::OverworldSimWalker(OverworldSim& sim, SimWalkerRules rules, const OverworldInterruptSet& walker) : m_sim(sim) , m_rules(rules) @@ -793,12 +790,13 @@ bool OverworldSimWalker::fade_over_since(Milliseconds from) const{ // was a wild battle's, run from. wait_out_warp()'s watcher takes a wild // battle's wipe for the fade (run 7; console B, 2026-11-03, Mt. Moon 1F): // the battle screen stands in for the wipe. The fade is watched for from -// `watched_from`: a fade over by then is missed. No warp: up to -// WARP_RETRY_TAPS steps more. +// `watched_from`: a fade over by then is missed. No warp: a step more, +// twice: a hold ends up to two tiles short, and an arrow warp (stairs) +// fires on the press made standing on it. bool OverworldSimWalker::after_warp(const RouteStep& step, int warps_before, Milliseconds watched_from){ bool battle = false; if (m_sim.state().warps == warps_before && !(battle = m_sim.watch({SimWatcher::BATTLE_SCREEN}, WARP_TIMEOUT).has_value())){ - for (int tap = 0; tap < WARP_RETRY_TAPS && m_sim.state().warps == warps_before; tap++){ + for (int tap = 0; tap < 2 && m_sim.state().warps == warps_before; tap++){ m_log.push_back("Route: no fade; one more step into the warp."); watched_from = m_sim.state().time; m_sim.tap(step.direction, STEP_TAP, STEP_TAP_RELEASE); @@ -996,8 +994,6 @@ std::string OverworldSimWalker::run(const std::vector& route, const R return ""; } - - } // namespace PokemonFRLG } // namespace NintendoSwitch } // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp index 4892ee6465..1cc21a731f 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp @@ -305,8 +305,9 @@ void wait_out_warp(ConsoleHandle& console, ProControllerContext& context, const return; } // A hold that ended short of a stairs or door warp, or on an arrow - // warp: a step more at a time takes it. - for (int tap = 0; tap < WARP_RETRY_TAPS; tap++){ + // warp: a step more at a time, twice, takes it. A hold ends up to two + // tiles short, and an arrow warp fires on the press made standing on it. + for (int tap = 0; tap < 2; tap++){ console.log("Route: no fade; one more step into the warp.", COLOR_ORANGE); BlackScreenOverWatcher arrival(COLOR_RED); Pokemon::WatchAlong retry_fade(arrival); From 4854152c26a6a61f516e5d5a699e367c03499795 Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 02:34:46 -0800 Subject: [PATCH 09/10] FRLG AutoStory 00.32: tap every open-floor walk on the hideout floors Row 17 to below the lift and B4F from the lift door to the guards, Giovanni and the SILPH SCOPE are now taps legs, one checked tap per tile; the MOON STONE, Giovanni and the SILPH SCOPE keep a turn-only route to face them. The sweep checks run them all with each turn dropped. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../PokemonFRLG_AutoStoryHideout_Tests.cpp | 32 +++- .../ReplayData/frlg-story-sim-trace.json | 85 +++++---- .../AutoStory/StoryData/frlg-00.32.plan.json | 162 ++++++++++++------ 3 files changed, 183 insertions(+), 96 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp index a5667dedc1..a17260a261 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHideout_Tests.cpp @@ -299,13 +299,17 @@ UnitTestResult test_b3f_maze_taps(){ // 00.32's taps (frlg-00.32.plan.json): B3F from below its Rare Candy up // to the top corridor, and B2F's arrows to the MOON STONE's stop and on -// to the lift room's stop (13, 20) and up to row 17, with any one turn -// dropped; the routes between them, with no arrow on the way, with any -// hold short. +// to the lift room's stop (13, 20), up to row 17 and on to below the +// lift, and B4F from the lift door to the guards, Giovanni and the +// SILPH SCOPE, with any one turn dropped; the stairs up from B3F, which +// end on their warp, with any hold short. UnitTestResult test_b2f_maze_taps(){ using Pokemon::StoryLeg; const MapPosition b2f_stairs{"RocketHideout_B2F", {21, 2}}; const MapPosition lift_stop{"RocketHideout_B2F", {13, 20}}; + const MapPosition left_guard{"RocketHideout_B4F", {16, 15}}; + const MapPosition right_guard{"RocketHideout_B4F", {19, 15}}; + const MapPosition below_giovanni{"RocketHideout_B4F", {19, 5}}; const std::vector failures{ tap_legs_on_sim({"RocketHideout_B3F", {12, 13}}, Direction::NORTH, { {Direction::WEST, 4}, {Direction::NORTH, 2}, {Direction::EAST, 4}, {Direction::NORTH, 7}, @@ -321,10 +325,24 @@ UnitTestResult test_b2f_maze_taps(){ tap_legs_on_sim(lift_stop, Direction::EAST, { {Direction::EAST, 2}, {Direction::NORTH, 3}, }, {"RocketHideout_B2F", {15, 17}}), - // Not row 17 east to below the lift (28, 17): a hold short ends on - // (27, 17), open floor, which the walker doesn't notice yet. - short_holds_on_sim({"RocketHideout_B4F", {20, 24}}, Direction::SOUTH, {"RocketHideout_B4F", {16, 15}}), - short_holds_on_sim({"RocketHideout_B4F", {19, 15}}, Direction::NORTH, {"RocketHideout_B4F", {19, 5}}), + tap_legs_on_sim({"RocketHideout_B2F", {1, 4}}, Direction::WEST, { + {Direction::EAST, 1}, + }, {"RocketHideout_B2F", {2, 4}}), + tap_legs_on_sim({"RocketHideout_B2F", {15, 17}}, Direction::NORTH, { + {Direction::EAST, 12}, {Direction::SOUTH, 1}, {Direction::EAST, 1}, {Direction::NORTH, 1}, + }, {"RocketHideout_B2F", {28, 17}}), + tap_legs_on_sim({"RocketHideout_B4F", {20, 23}}, Direction::SOUTH, { + {Direction::SOUTH, 1}, {Direction::WEST, 4}, {Direction::NORTH, 9}, + }, left_guard), + tap_legs_on_sim(left_guard, Direction::NORTH, { + {Direction::SOUTH, 1}, {Direction::EAST, 3}, {Direction::NORTH, 1}, + }, right_guard), + tap_legs_on_sim(right_guard, Direction::NORTH, { + {Direction::WEST, 2}, {Direction::NORTH, 10}, {Direction::EAST, 2}, + }, below_giovanni), + tap_legs_on_sim(below_giovanni, Direction::NORTH, { + {Direction::WEST, 2}, {Direction::SOUTH, 2}, {Direction::EAST, 4}, {Direction::NORTH, 2}, + }, {"RocketHideout_B4F", {21, 5}}), }; for (const std::string& failure : failures){ if (!failure.empty()){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json index 950ca337a9..e66489918d 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/ReplayData/frlg-story-sim-trace.json @@ -1341,7 +1341,7 @@ "[Checkpoint] 00.31: done, 20 run, 0 skipped", "[Checkpoint] 00.31: passed on attempt 1 (one-shot)", "begin 00.32", - "[Checkpoint] 00.32: start, 22 events", + "[Checkpoint] 00.32: start, 25 events", "[Event] 00.32/1 from_save: start", "[Event] 00.32/1 from_save: done", "[Event] 00.32/2 b3f_to_top_corridor: start", @@ -1353,62 +1353,71 @@ "[Event] 00.32/4 b2f_arrows_to_moon_stone: start", "00.32/b2f_arrows_to_moon_stone: ok at RocketHideout_B2F (1, 4) facing west (tile)", "[Event] 00.32/4 b2f_arrows_to_moon_stone: done", - "[Event] 00.32/5 above_moon_stone: start", + "[Event] 00.32/5 beside_moon_stone: start", + "00.32/beside_moon_stone: ok at RocketHideout_B2F (2, 4) facing east (tile)", + "[Event] 00.32/5 beside_moon_stone: done", + "[Event] 00.32/6 above_moon_stone: start", "00.32/above_moon_stone: ok at RocketHideout_B2F (2, 4) facing south (tile)", - "[Event] 00.32/5 above_moon_stone: done", - "[Event] 00.32/6 moon_stone: start", + "[Event] 00.32/6 above_moon_stone: done", + "[Event] 00.32/7 moon_stone: start", "00.32/moon_stone: ok at -", - "[Event] 00.32/6 moon_stone: done", - "[Event] 00.32/7 b2f_arrows_to_lift_room: start", + "[Event] 00.32/7 moon_stone: done", + "[Event] 00.32/8 b2f_arrows_to_lift_room: start", "00.32/b2f_arrows_to_lift_room: ok at RocketHideout_B2F (13, 20) facing east (tile)", - "[Event] 00.32/7 b2f_arrows_to_lift_room: done", - "[Event] 00.32/8 lift_room_to_row_17: start", + "[Event] 00.32/8 b2f_arrows_to_lift_room: done", + "[Event] 00.32/9 lift_room_to_row_17: start", "00.32/lift_room_to_row_17: ok at RocketHideout_B2F (15, 17) facing north (tile)", - "[Event] 00.32/8 lift_room_to_row_17: done", - "[Event] 00.32/9 below_lift: start", + "[Event] 00.32/9 lift_room_to_row_17: done", + "[Event] 00.32/10 below_lift: start", "00.32/below_lift: ok at RocketHideout_B2F (28, 17) facing north (tile)", - "[Event] 00.32/9 below_lift: done", - "[Event] 00.32/10 lift_to_b4f: start", + "[Event] 00.32/10 below_lift: done", + "[Event] 00.32/11 lift_to_b4f: start", "00.32/lift_to_b4f: ok at RocketHideout_B2F (28, 17) facing north (tile)", - "[Event] 00.32/10 lift_to_b4f: done", - "[Event] 00.32/11 below_left_guard: start", + "[Event] 00.32/11 lift_to_b4f: done", + "[Event] 00.32/12 below_left_guard: start", "00.32/below_left_guard: ok at RocketHideout_B4F (16, 15) facing north (tile)", - "[Event] 00.32/11 below_left_guard: done", - "[Event] 00.32/12 talk_left_guard: start", + "[Event] 00.32/12 below_left_guard: done", + "[Event] 00.32/13 talk_left_guard: start", "00.32/talk_left_guard: ok at -", - "[Event] 00.32/12 talk_left_guard: done", - "[Event] 00.32/13 left_guard: start", + "[Event] 00.32/13 talk_left_guard: done", + "[Event] 00.32/14 left_guard: start", "00.32/left_guard: ok at -", - "[Event] 00.32/13 left_guard: done", - "[Event] 00.32/14 below_right_guard: start", + "[Event] 00.32/14 left_guard: done", + "[Event] 00.32/15 below_right_guard: start", "00.32/below_right_guard: ok at RocketHideout_B4F (19, 15) facing north (tile)", - "[Event] 00.32/14 below_right_guard: done", - "[Event] 00.32/15 talk_right_guard: start", + "[Event] 00.32/15 below_right_guard: done", + "[Event] 00.32/16 talk_right_guard: start", "00.32/talk_right_guard: ok at -", - "[Event] 00.32/15 talk_right_guard: done", - "[Event] 00.32/16 right_guard: start", + "[Event] 00.32/16 talk_right_guard: done", + "[Event] 00.32/17 right_guard: start", "00.32/right_guard: ok at -", - "[Event] 00.32/16 right_guard: done", - "[Event] 00.32/17 below_giovanni: start", + "[Event] 00.32/17 right_guard: done", + "[Event] 00.32/18 beside_giovanni: start", + "00.32/beside_giovanni: ok at RocketHideout_B4F (19, 5) facing east (tile)", + "[Event] 00.32/18 beside_giovanni: done", + "[Event] 00.32/19 below_giovanni: start", "00.32/below_giovanni: ok at RocketHideout_B4F (19, 5) facing north (tile)", - "[Event] 00.32/17 below_giovanni: done", - "[Event] 00.32/18 talk_giovanni: start", + "[Event] 00.32/19 below_giovanni: done", + "[Event] 00.32/20 talk_giovanni: start", "00.32/talk_giovanni: ok at -", - "[Event] 00.32/18 talk_giovanni: done", - "[Event] 00.32/19 giovanni: start", + "[Event] 00.32/20 talk_giovanni: done", + "[Event] 00.32/21 giovanni: start", "00.32/giovanni: ok at -", - "[Event] 00.32/19 giovanni: done", - "[Event] 00.32/20 beside_silph_scope: start", + "[Event] 00.32/21 giovanni: done", + "[Event] 00.32/22 east_of_silph_scope: start", + "00.32/east_of_silph_scope: ok at RocketHideout_B4F (21, 5) facing north (tile)", + "[Event] 00.32/22 east_of_silph_scope: done", + "[Event] 00.32/23 beside_silph_scope: start", "00.32/beside_silph_scope: ok at RocketHideout_B4F (21, 5) facing west (tile)", - "[Event] 00.32/20 beside_silph_scope: done", - "[Event] 00.32/21 silph_scope: start", + "[Event] 00.32/23 beside_silph_scope: done", + "[Event] 00.32/24 silph_scope: start", "00.32/silph_scope: ok at -", - "[Event] 00.32/21 silph_scope: done", - "[Event] 00.32/22 escape_rope_hideout: start", + "[Event] 00.32/24 silph_scope: done", + "[Event] 00.32/25 escape_rope_hideout: start", "00.32/escape_rope_hideout: ok at RocketHideout_B4F (21, 5) facing west (tile)", - "[Event] 00.32/22 escape_rope_hideout: done", + "[Event] 00.32/25 escape_rope_hideout: done", "save at CeladonCity (34, 22) facing south (tile)", - "[Checkpoint] 00.32: done, 22 run, 0 skipped", + "[Checkpoint] 00.32: done, 25 run, 0 skipped", "[Checkpoint] 00.32: passed on attempt 1 (one-shot)", "[Segment] 00: 36 of 36 checkpoints one-shot", "[Segment] 00: done, 36 checkpoints", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json index 99195761cb..8b706af9b0 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-00.32.plan.json @@ -95,6 +95,18 @@ ], "why": "a tap a tile, west of the turning Grunt (20, 6) and out of his lines (sight 2): down to (21, 3), west to (19, 3), down to (19, 5), west to (17, 5), down to (17, 6), west onto the arrow (16, 6), which slides west and, turned at (11, 6) and (11, 4), on to the stop (1, 4)" }, + { + "id": "beside_moon_stone", + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "east", + "tiles": 1 + } + ], + "why": "a tap east from the stop (1, 4) to above the MOON STONE (2, 5), which stands in the only way on (pokeguy 57:52)" + }, { "id": "above_moon_stone", "kind": "route", @@ -113,7 +125,7 @@ } }, "variant": "run", - "why": "a step east, above the MOON STONE (2, 5), which stands in the only way on (pokeguy 57:52)" + "why": "turn to face the MOON STONE (2, 5): no tile to walk" }, { "id": "moon_stone", @@ -190,23 +202,27 @@ }, { "id": "below_lift", - "kind": "route", - "target": { - "certainty": "tile", - "map": "RocketHideout_B2F", - "where": { - "facing": "north", - "kind": "tiles", - "tiles": [ - [ - 28, - 17 - ] - ] + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "east", + "tiles": 12 + }, + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "east", + "tiles": 1 + }, + { + "direction": "north", + "tiles": 1 } - }, - "variant": "run", - "why": "east along row 17 to below the lift door (28, 16); no arrow on the way" + ], + "why": "a tap a tile along row 17 to (27, 17), down to row 18 and east to (28, 18), and up to below the lift door (28, 16), facing it" }, { "id": "lift_to_b4f", @@ -234,23 +250,23 @@ }, { "id": "below_left_guard", - "kind": "route", - "target": { - "certainty": "tile", - "map": "RocketHideout_B4F", - "where": { - "facing": "north", - "kind": "tiles", - "tiles": [ - [ - 16, - 15 - ] - ] + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "west", + "tiles": 4 + }, + { + "direction": "north", + "tiles": 9 } - }, - "variant": "run", - "why": "from the lift door up to below the left door Grunt (16, 14)" + ], + "why": "a tap a tile off the lift door (20, 23): down to (20, 24), west to (16, 24) and up column 16 to below the left door Grunt (16, 14)" }, { "id": "talk_left_guard", @@ -278,23 +294,23 @@ }, { "id": "below_right_guard", - "kind": "route", - "target": { - "certainty": "tile", - "map": "RocketHideout_B4F", - "where": { - "facing": "north", - "kind": "tiles", - "tiles": [ - [ - 19, - 15 - ] - ] + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "east", + "tiles": 3 + }, + { + "direction": "north", + "tiles": 1 } - }, - "variant": "run", - "why": "east along row 15 to below the right door Grunt (19, 14)" + ], + "why": "a tap a tile: down to (16, 16), east along row 16 to (19, 16) and up to below the right door Grunt (19, 14)" }, { "id": "talk_right_guard", @@ -320,6 +336,26 @@ }, "why": "Rocket Grunt (TRAINER_TEAM_ROCKET_GRUNT_17): Ekans, Sandshrew, Arbok Lv23 (Arbok's Glare paralysed pokeguy's Wartortle, 59:44)" }, + { + "id": "beside_giovanni", + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "west", + "tiles": 2 + }, + { + "direction": "north", + "tiles": 10 + }, + { + "direction": "east", + "tiles": 2 + } + ], + "why": "a tap a tile: west to (17, 15), up column 17 between the guards (17..18, 12..13) to the wall at (17, 5), and east to below Giovanni (19, 4)" + }, { "id": "below_giovanni", "kind": "route", @@ -338,7 +374,7 @@ } }, "variant": "run", - "why": "between the guards (17..18, 12..13) and up to below Giovanni (19, 4)" + "why": "turn to face Giovanni (19, 4): no tile to walk" }, { "id": "talk_giovanni", @@ -364,6 +400,30 @@ }, "why": "Giovanni (TRAINER_BOSS_GIOVANNI): Onix, Rhyhorn, Kangaskhan" }, + { + "id": "east_of_silph_scope", + "kind": "legs", + "variant": "taps", + "legs": [ + { + "direction": "west", + "tiles": 2 + }, + { + "direction": "south", + "tiles": 2 + }, + { + "direction": "east", + "tiles": 4 + }, + { + "direction": "north", + "tiles": 2 + } + ], + "why": "a tap a tile round by row 7: west to (17, 5), down to (17, 7), east to the wall at (21, 7) and up to the wall at (21, 5), east of the SILPH SCOPE (20, 5)" + }, { "id": "beside_silph_scope", "kind": "route", @@ -382,7 +442,7 @@ } }, "variant": "run", - "why": "round by row 7 to east of the SILPH SCOPE (20, 5)" + "why": "turn to face the SILPH SCOPE (20, 5): no tile to walk" }, { "id": "silph_scope", From 212a1ebccfcf1be0901b81115475ccabcb2b0ecf Mon Sep 17 00:00:00 2001 From: dayfine Date: Tue, 10 Nov 2026 02:41:52 -0800 Subject: [PATCH 10/10] FRLG AutoStory 00.32: judge a tap's step on all four edge bands The tap judge compared only the top quarter of the screen. On Rocket Hideout B3F the floor repeats every tile, so a one-tile scroll left the band nearly unchanged: real steps read as turns, the retries overshot, and the route ended off its path (00.32 run 1). Take the largest change over the top, bottom, left and right quarters instead, all clear of the player. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../PokemonFRLG_OverworldBike_Tests.cpp | 42 +++++++++++++++++++ .../PokemonFRLG_OverworldRecoveryWalk.cpp | 36 +++++++++------- .../PokemonFRLG_OverworldRecoveryWalk.h | 17 ++++++++ 3 files changed, 80 insertions(+), 15 deletions(-) diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldBike_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldBike_Tests.cpp index eca8adf9da..8fc91a73c5 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldBike_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldBike_Tests.cpp @@ -17,7 +17,9 @@ #include "PokemonFRLG_BikeSpinPresses.h" #include "PokemonFRLG_BikeSpinMechanics.h" #include "PokemonFRLG_OverworldMaps.h" +#include "CommonFramework/ImageTypes/ImageRGB32.h" #include "PokemonFRLG_OverworldRecovery.h" +#include "PokemonFRLG_OverworldRecoveryWalk.h" #include "PokemonFRLG_OverworldRoute.h" #include "PokemonFRLG_OverworldSim.h" #include "PokemonFRLG_OverworldSimField.h" @@ -215,7 +217,47 @@ UnitTestResult test_speed_after_door(){ return true; } +// A floor that repeats every 16-pixel tile, with a pillar on the bottom +// row, seen from `scroll` pixels east. +ImageRGB32 periodic_floor(size_t scroll){ + ImageRGB32 image(160, 160); + for (size_t y = 0; y < 160; y++){ + for (size_t x = 0; x < 160; x++){ + const size_t floor_x = x + scroll; + uint32_t pixel = (floor_x % 16 < 8) ^ (y % 16 < 8) ? 0xff808040 : 0xffa0a060; + if (y >= 130 && floor_x >= 100 && floor_x < 120){ + pixel = 0xff000000; + } + image.pixel(x, y) = pixel; + } + } + return image; +} + +// Rocket Hideout B3F (00.32 run 1): a tap east over a floor that repeats +// every tile left the top band the same, so the tap read as a turn. +UnitTestResult test_scroll_over_periodic_floor(){ + const ImageFloatBox game(0, 0, 1, 1); + const ImageRGB32 before = periodic_floor(0); + const double stepped = tap_scroll_change(before, periodic_floor(16), game); + if (stepped <= WALL_TAP_MOVED_RMSD){ + return std::format("Expected a one-tile scroll to read as a step: change {}.", stepped); + } + ImageRGB32 turned = periodic_floor(0); + for (size_t y = 64; y < 96; y++){ + for (size_t x = 64; x < 96; x++){ + turned.pixel(x, y) = 0xffff0000; + } + } + const double bumped = tap_scroll_change(before, turned, game); + if (bumped > WALL_TAP_MOVED_RMSD){ + return std::format("Expected the player turning in the middle not to read as a step: change {}.", bumped); + } + return true; +} + const BikeCase OVERWORLD_BIKE_CASES[] = { + {.input = {"a tap over a floor that repeats every tile", test_scroll_over_periodic_floor}, .expectation = {"scroll seen at the bottom edge; a turn is not"}}, {.input = {"taps a tile each, one in 12 dropped 60ms apart", test_tap_chains}, .expectation = {"23 of 25 tiles at 60ms; 25 at 100 and 120ms"}}, {.input = {"an open leg of 11 from a start 2 off, counted in taps", test_counted_leg_off_start}, .expectation = {"found against the rock and walked back"}}, {.input = {"SELECT onto the registered Bicycle", test_select_onto_bike}, .expectation = {"one press registered; two and off unregistered"}}, diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp index 18b365317f..a2787d36ca 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.cpp @@ -4,6 +4,7 @@ * */ +#include #include #include #include @@ -61,21 +62,26 @@ struct StepWalk{ bool blocked = false; }; -// TODO(forest drift, 2026-11-01): the threshold is a diagnostic's guess. -// How much the game screen's top quarter, clear of the player in the -// middle, may change when a tap toward a wall only bumps the player (the -// player's own animation, an animated tile). A step scrolls the whole map -// by a tile. Not yet measured on the console: a guess on the safe side. -constexpr double WALL_TAP_MOVED_RMSD = 20.0; - -// How much the top quarter of the game screen changed from `before` to -// `after`: a step scrolls it by a tile. -double top_band_change(const ImageViewRGB32& before, const ImageViewRGB32& after){ - const ImageFloatBox game = GameSettings::instance().GAME_BOX; - const ImageFloatBox band(game.x, game.y, game.width, game.height * 0.25); - return ImageMatch::pixel_RMSD(extract_box_reference(before, band), extract_box_reference(after, band)); +} // namespace + +double tap_scroll_change(const ImageViewRGB32& before, const ImageViewRGB32& after, const ImageFloatBox& game){ + const double w = game.width * 0.25; + const double h = game.height * 0.25; + const ImageFloatBox bands[] = { + {game.x, game.y, game.width, h}, + {game.x, game.y + game.height - h, game.width, h}, + {game.x, game.y, w, game.height}, + {game.x + game.width - w, game.y, w, game.height}, + }; + double most = 0; + for (const ImageFloatBox& band : bands){ + most = std::max(most, ImageMatch::pixel_RMSD(extract_box_reference(before, band), extract_box_reference(after, band))); + } + return most; } +namespace{ + // A counted tap's press, its release and the wait after it for the // screen to show the step. struct TapTiming{ @@ -116,7 +122,7 @@ BikeTap console_bike_tap( return BikeTap{.moved = false, .interrupt = (size_t)ret}; } const VideoSnapshot after = console.video().snapshot(); - if (before && after && top_band_change(before, after) > WALL_TAP_MOVED_RMSD){ + if (before && after && tap_scroll_change(before, after, GameSettings::instance().GAME_BOX) > WALL_TAP_MOVED_RMSD){ return BikeTap{.moved = true}; } const bool late = Pokemon::clear_late_interrupts(console, context, interrupts, AFTER_LEG_WATCH, MAX_INTERRUPTIONS_PER_LEG) > 0; @@ -411,7 +417,7 @@ bool moved_past_wall(ConsoleHandle& console, ProControllerContext& context, cons if (!before || !after){ return false; } - const double change = top_band_change(before, after); + const double change = tap_scroll_change(before, after, GameSettings::instance().GAME_BOX); console.log(std::format("Position check: a tap toward the wall of {} changed the screen by {:.1f}.", to_string(step), change)); return change > WALL_TAP_MOVED_RMSD; } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.h index 51cd54ac1a..a65eca8c20 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldRecoveryWalk.h @@ -15,6 +15,8 @@ #include #include +#include "CommonFramework/ImageTools/ImageBoxes.h" +#include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "NintendoSwitch/Controllers/Procon/NintendoSwitch_ProController.h" #include "NintendoSwitch/NintendoSwitch_ConsoleHandle.h" #include "PokemonFRLG_OverworldRecovery.h" @@ -26,6 +28,21 @@ namespace NintendoSwitch{ namespace PokemonFRLG{ +// TODO(forest drift, 2026-11-01): the threshold is a diagnostic's guess. +// How much each edge quarter of the game screen, clear of the player in the +// middle, may change when a tap toward a wall only bumps the player (the +// player's own animation, an animated tile). A step scrolls the whole map +// by a tile. Not yet measured on the console: a guess on the safe side. +constexpr double WALL_TAP_MOVED_RMSD = 20.0; + +// How much a counted tap scrolled the map: the largest RMSD between `before` +// and `after` over the four edge quarters (top, bottom, left, right) of +// `game`, all clear of the player in the middle. One band alone misses a +// step over a floor that repeats every tile (Rocket Hideout B3F, 00.32): a +// one-tile scroll leaves the band nearly the same. +double tap_scroll_change(const ImageViewRGB32& before, const ImageViewRGB32& after, const ImageFloatBox& game); + + // Walks `route`, planned with `planning`, at `speed`, as // walk_overworld_route() does, from the same start: standing still on the // overworld, not on the bike, facing `facing` (read from the screen if not