Repository navigation
Conversation
The RNG programs' documentation lists how many free party slots each one needs. Check that at program startup through a new pre-startup hook, start_program_game_checks(), instead of failing after a catch or gift goes to the box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
|
I'm backtracking on the navigation behavior tests like you'd added in #1663 -- testing is usually done by running the program on a Switch to observe its behavior, and my impression is that getting the logic wrong for the navigation means you'll probably write tests that get it wrong, too, making them less than useful. Without the need for the tests, the additions here can probably be reduced to only a few files:
Feel free to push back if I'm missing anything important. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…heck Each case runs check_party_free_slots() with the real slot detector on a party menu screenshot, replacing the scripted PartyCheck cases and the separate LastOccupiedPartySlot test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…tion#1896 Upstream removed scripted navigation behavior tests (PokemonAutomation#1896). Follow it: take its Navigation and Tests files, drop PartyCheckActions, the image overload of detect_last_occupied_party_slot and the party check tests, and run the check directly in start_program_game_checks(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Removed the tests here.
The tests here are indeed not the most interesting (as it's mostly just value-mapping), but there are potential cases where the tests could be more useful (when state is more complicated / to guard against corner cases).
One thing I figured in most programs is that they do have some preconditions, but there is programmatically checks for them; then they just fail either silently or loudly but only after spending quite some times running up to the failure point. So I think a general pre-start program hook could be valuable / useful for other programs. e.g. just picking a random program like: https://pokemonautomation.github.io/Programs/PokemonFRLG/PrizeCornerReset.html
This is most common where we can check / correct the settings
So this is similar in checking party free slot (though it's a reset program, not a RNG program). (but it can be tricky to abstract well what this really is -- like a ShinyHuntingProgram(Mixin))? In that regard we don't necessary need a base class here in order to share, though that's relatively straightforward. I've done similar things at work just recently using template policies, but that's more involved and likely not necessary right now. |
|
My comments are mostly motivated by 1) handling things similarly to other checks at the start of the program, like the black border check, for easier readability, and 2) my only really having "ownership" over FRLG code. I'm just an imposter who has stumbled into helping maintain the FRLG stuff, so I try to minimize changes to anything at a higher level. If you'd like to go forward with the changes to |
…itchProgram hook Drop the start_program_game_checks() hook from SingleSwitchProgramInstance. Each RNG program calls check_free_party_slots() first in program(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
|
Sure. Will leave out I added a |
|
Thanks for the review! |
2e779a7 to
5d1fc80
Compare
|
Would you be willing to test out a few more of the programs with these changes to make sure the new check works as intended in each? Especially the Egg RNG and Wild RNG Safari Zone cases which needed tweaking. |
|
@theastrogoth yes let me run a couple. Haven't really ran Egg RNG and Wild RNG so far |
…ty slots check) into frlg/stage2-rng Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…omation#1881 merged up the chain (no content change here)
|
I ran 6 setup-only tests and 1 real RNG program run to hit
Full report written by agent below:
Findings (for #1881 / WildRng; suggestions, not blockers)
Log linesSetup note: lab-B's EggRng/WildRng/StaticRng/RoamingLegendaryRng panels had no controller/video bound; copied CFR's ConsoleSetup (21:12). 1 Gift +2 Gift − (party 6: withdrew Magikarp + Rattata at Cinnabar Center, unsaved)3 Wild +4 Wild − (party 6)5 Egg + (pickup_frame)6 Egg − (held_prep)7 Wild real run (Safari Zone center, grass)Setup (21:24–21:32): soft reset (party back to 4) → Fly Fuchsia → walk to Safari entrance (route from pokesim route CLI) → stand on the Poké Ball logo → Super Repel (no Max Repel in bag; 5→4) → SAVE (overwrote the Cinnabar story save, user OK). Money ₽16,946, TID 15287. Try 2, ADVANCES 5000 — running: After: restore the story save — reset, walk out, Fly Cinnabar, stand outside the lab door facing up, save. Try 3 (21:46) FAILED on my setup: launch with the license check worked (paid ₽500, walked into the center grass), then "WildRng(): Failed to trigger battle" (21:47:43). The error-report video shows the program opening the party and the LAST slot's first field move — Eevee, no Sweet Scent — landing in SUMMARY/SWITCH. The doc says grass needs a Sweet Scent user in the last slot; I missed it. Finding for #1881/WildRng: the precheck already opens the party, so it could also check the last slot has Sweet Scent (grass/surf) and fail with a setup message instead of "Failed to trigger battle" after a full reset. Case 7 result: PASS (target hit), 2026-11-13 22:34Run restarted by the user at 22:25 (Max Resets 40; calibration carried over from tries 4: seed cal 0.083 f, CSF 0.5, in-game 1.83). |
…s, hook done) Fork-only for now for the app seams and the mGBA work, kept small enough to upstream later. Preconditions are a list of named check objects declared with the program (prechecks()/run_prechecks(), generalizing FRLG RNG's run_precheck from upstream PokemonAutomation#1881); they land in Slice 4 and the server first refuses runs on them in Slice 5. The require-profile PreToolUse hook is done, so Enforcement describes it instead of planning it. The open questions are listed with a recommended answer each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
|
Since it seems like you might plan to expand the program start checks later on, I'd like an option to disable them. I'm torn on it being in FRLG Game Settings in a new "RNG Settings" section alongside the license check, or as a per-program settings checkbox. Common usage for me includes noticing a mistake in my entered settings by watching the "Target Details" box, and then restarting the program after fixing my settings, which could get frustrating if each restart needs to go through a bunch of checks. Exhaustively checking all in-game setup would eventually need to look for Teachy TV in the top bag slot (when used), Rare Candy and Max Repel positions (and possibly quantities), Fishing Rod or Bike registration, Sweet Scent, in-game location (visible on the Save dialog), game version (from the title screen, maybe?), text speed, button mode, and audio settings as well -- I'm fine with not handling any of these, mostly because they involve OCR, which can be finicky and can be annoying to acquire test images for in each language. Regarding Claude's findings:
|
"Run Start Checks" in the FRLG Game Settings, in a new RNG Settings section with the license check. Off skips the party check; the black border check always runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Moves the seven open questions to settled with their recommended answers, writes the nine answers from the 2026-11-14 implementation review into the resources, lease, tool and slice text, corrects the legacy Lab/state fields and what 7c44e72 does, and records Slices 0-3 as built (#478, #481, #482, #483) and Slice 4 as approved on PokemonAutomation#1881's branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
A Precheck has a stable name, a one-line "needs" and a policy (REQUIRED or OPTIONAL). run_prechecks() runs a list in order, leaves out the OPTIONAL ones when asked, returns one result per check (name, passed/failed/skipped, message) and throws UserSetupError with the check's message at the first failure. FRLG RNG's run_precheck() now runs rng_prechecks(n): black_border (REQUIRED), then free_party_slots(n) (OPTIONAL, only when n > 0). The "Run Start Checks" box in the FRLG Game Settings skips the OPTIONAL checks, as it skipped the party check before. Messages are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…de health OPTIONAL is a macro in the Windows headers, so the policy values are ALWAYS_RUNS and SKIPPABLE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Prechecks: a program's start checks as a named list, FRLG RNG first
|
This seems to have veered back into touching code that is shared with many unrelated programs. I'm still not convinced we need the extra layers of abstraction and shared classes to handle something that boils down to "do this first when the program starts". I'm also not sure that the new tests are needed or particularly helpful. I also asked Claude to give this a look, in case I'm missing something, but it basically came up with a more longwinded version of my comment from a few days ago (which probably could have been more clear, apologies). Snippets from its response below, but TLDR we can avoid the new base classes and precheck framework for now: The base class (
The precheck framework (
What I'd suggest instead The useful part, checking for free party slots, could be one free function in the RNG folder, e.g.
Each program would add If you want to add more checks later on, you could pass |
|
@theastrogoth sorry that should not have landed here right now. Reverted. |



The documentation pages of the RNG programs document the number of free party slots needed. Programs might fail after catching / receiving when there is no free slot, as the pokemon got sent to box.
This PR actually checks for those requirements at program startup, by introducing a general pre-startup hook for programs.
Testing
On a Switch1 with a full party (when catching Mewtwo), Static RNG on this build stopped with that message 5 seconds after starting, before any of its own setup; before, it ran five resets (about 30 minutes) and stopped with the seed error.