Skip to content

FRLG: make Starter RNG's attempts and SID Helper's steps callable - #183

Closed
dayfine wants to merge 36 commits into
frlg/autostory-rng-planfrom
frlg/rng-callable-steps
Closed

dayfine wants to merge 36 commits into
frlg/autostory-rng-planfrom
frlg/rng-callable-steps

Conversation

@dayfine

@dayfine dayfine commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Depends on #182 (base frlg/autostory-rng-plan; the diff shows only this change).

AutoStory needs to run Starter RNG's attempt loop and SID Helper's naming-screen steps, but both lived inside their programs with the programs' own options. This prep refactor, with no behaviour change, moves the loop into StarterRngAttempts (target, settings, displays, notifications and stats come from the caller; run() returns shiny / target hit with the target's PID, nature and IVs / wild shiny / out of resets / no matches) and moves set_sid_from_name_screen, finish_intro_animations and the delay computation (sid_timing) into PokemonFRLG_SidSteps. StarterRng and SidHelper now call these with the same presses, waits, logs, stats and notifications; StarterRng still fires the "no matches" error itself. Two additions for AutoStory are off for StarterRng, so it runs as before: an on_reset hook called after each reset, and identify_shiny, which reads a shiny starter's summary and searches near the target. With it on, a shiny comes back as shiny_on_target or shiny_off_target.

The bodies are moved unchanged except where long functions were split to pass code health (about 40% of changed lines show as moved): git diff --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change frlg/autostory-rng-plan...frlg/rng-callable-steps.

Tested by compiling the touched files locally with -Wmissing-designated-field-initializers and code health (0 failures); new PokemonFRLG::RngSteps unit tests cover the SID timing per language, the per-starter tables and identify_shiny(). All pass in a test runner linked against a local full build. Not run on a Switch.

  • on_read (off for StarterRng): after each reset's reads, the attempts hand the caller the search hits and the state the calibration took as hit (reset_hit(), tested in PokemonFRLG::RngSteps), for AutoStory's one line per reset.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

dayfine and others added 2 commits November 2, 2026 15:54
Starter RNG's reset, calibrate and attempt loop moves out of
StarterRng::program() into StarterRngAttempts, which takes the target,
settings, displays, notifications and stats from its caller and returns
a StarterRngOutcome (shiny, target hit with the target's PID/nature/IVs,
wild shiny, out of resets, no matches). StarterRng runs it with its own
options and fires the same "no matches" error itself.

SID Helper's naming-screen steps (set_sid_from_name_screen,
finish_intro_animations) and its delay computation (sid_timing) move to
PokemonFRLG_SidSteps.

No behaviour change: same presses, waits, logs, stats and notifications.
Long functions are split to stay under the code-health limits; the
per-starter tables and the SID timing get unit tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 3 commits November 2, 2026 16:54
Called after each reset with the resets so far and the calibration that
reset was timed with, for a caller that logs the attempts (AutoStory,
#184). StarterRng passes none, so it runs as before.

Moved here from #184, which uses it, so that each PR owns its files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
A shiny after a reset ended the attempts as "shiny" without knowing
whether it was the target or another advance; AutoStory (#184) needs to
know before it uses the shiny to narrow the SID. With the new
identify_shiny setting, StarterRngAttempts reads the shiny's summary and
searches near the target as an attempt's first stage does, and ends as
shiny_on_target (the target is among the states its stats match, with
the target's PID, nature and IVs), shiny_off_target, or shiny when none
match. StarterRng leaves it off and stops on the shiny as before.

identify_shiny() is unit-tested in PokemonFRLG::RngSteps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 3, 2026
…move on

Starter RNG's attempts now tell whether a shiny was the target
(identify_shiny, #183). Only a shiny on the target narrows the SIDs; one
off it, or not known to be on it, ends the loop as SHINY_OFF_TARGET with
no SID confirmed and no "RngPlan: confirmed" line. Its result line says
outcome=shiny_off_target next=stop. Either shiny goes on with the story.

The result line names a try that ran past its deadline attempt_deadline,
apart from out_of_resets, no_matches and wild_shiny; all still count as a
miss. An attempt missed more often than the retries allow moves on to the
next one still shiny for a SID left (#182), and the run stops only when
none is left (MISSED_EVERY_ATTEMPT_LEFT). A shiny for none of the SIDs
left no longer says "one of" an empty list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 14 commits November 2, 2026 19:30
on_read hands a caller each reset's search hits and the state the
calibration took as hit (reset_hit()), or the shiny's hits, so AutoStory
can log one line per reset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…callable-steps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 10 commits November 3, 2026 01:40
…r RUN in a dark cave) into frlg/rng-callable-steps
…mpts out of step) into frlg/rng-callable-steps
…rlg/rng-callable-steps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…t name) into frlg/rng-callable-steps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
@dayfine

dayfine commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #214 (FRLG stack consolidated into stage PRs; will be resplit for upstream).

@dayfine dayfine closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant