Repository navigation
Conversation
|
The offline battle work is now merged in PokemonSimulation. Use this single handoff on Interface direction: AutoStory owns each game plan. Replay that actual plan as semantic logs to produce its ordered battle history, entering conditions and versioned policies; PokemonSimulation validates/simulates that history and returns a quality report. The 69 Pokeguy fights are a reference fixture, not the list or route every plan must adopt. This also applies to future Fire/Grass starter plans that catch, train and evolve supporters. The proposed replay/result/quality contract is documented in PokemonSimulation PR #39. I reviewed this PR at 1. Move simulation/analysis ownership out of Arduino-Source Paths below are under
Arduino-Source owns the game plan and its console execution, and should export the history produced by its planning replay. PokemonSimulation owns battle-mechanics analysis, NPC simulation, reference-data generation and evaluation of the supplied history. A replay exporter, general history importer and quality grader still need implementation; the Markdown handoff is a reference specification, not an already-shipping C++ plan bundle. An optional runtime data export must not reverse ownership of the game plan. Runtime action selection must remain responsive to the actual battle, rather than treating an offline win rate or opening move as a button script. Update build/test registrations as the old modules are removed. 2. Replace LOW/HIGH policy selection with explicit per-fight plans
Give the actual AutoStory plan explicit fight records keyed by stable fight/trainer ID, connected to
The current executable action vocabulary is only RUN/POTION/ANTIDOTE/MOVE. Extend Track the active opponent and its current HP/status, player HP/status/PP, stages and relevant effects. For the currently implemented stage through Brock, the known lab rival, Liam and Brock entries are A-labeled with B-default execution; none requires C. The Forest route explicitly meets Rick, so do not silently assign him Sammy's benchmark. Use the handoff's complete per-fight labels for matching trainers, and mark additional/unmatched encounters as unvalidated. 3. Make hard-fight preconditions an entry gate Before starting a hard fight, verify trainer/variant, actual species and level, numeric HP/max HP and status, raw summary stats, moves and remaining PP, held item, earned badges and the full required battle bag. Log expected versus observed values and the plan revision. Nature/IV/EV assumptions must fit the actual starter: match visible summary stats/level and track earned EVs or a compatible profile range; IVs need not be directly OCR-readable. An unread value is not a successful check. If they differ, recover/re-read or stop for an offline estimate of the actual state rather than attaching the handoff's probability to it. Two concrete fixes are needed here:
The six adopted rests are Sammy, Liam, Brock, Josh, Cerulean rival and S.S. Anne rival. They restore HP/status/PP, never the bag. Later C full-heal alternatives remain pending; automatically healing every boss would change the measured Torrent/setup conditions. These are the current ten lowest prepared-variant point estimates; verify the complete card in the linked handoff, not just the abbreviated condition here:
Brock/Liam each had 120/120 wins in the full-rest samples without HP medicine in their entry bags; that is not proof of a 100% true win rate. Bruno is still C even though it is outside this top ten: preserve its opening Torrent/equivalent-power plan rather than applying a universal heal. The handoff includes simultaneous intervals, the known B finishing-hit priority limitation, and the unproven whole-League PP reserve. Evaluate the quality of the exported plan Make the quality profile configurable: a minimum per-fight success probability (for example 60% or 70%, not a selected default), the required fraction of fights at or above 90%, and an explicitly defined easy/near-certain quota. Return the weakest fights, fractions, trials/uncertainty, coverage/input failures and the AutoStory event that produced each condition. Grade with simultaneous bounds: pass when lower bounds certify a requirement, fail when upper bounds rule it out, otherwise sample further or report inconclusive. Stop against these criteria instead of spending a fixed 1,000 trials on every fight. Keep “zero losses in n samples,” a user-selected near-certain threshold such as 99%/99.9%, and a genuine guaranteed-100% result separate. Finite Monte Carlo cannot certify literal 100%; an exact quota needs a proof/exhaustive capability or an explicit change in its interpretation. The X/Y quota values remain unchosen. Export the whole party and real capture/training/evolution/item/EXP/EV history for supporter plans. Unknown policies, unsupported capture/team objectives and uncovered branches must be reported, not silently simplified to the solo lead. Separate required-story fights from optional/training battles when defining quota denominators. Independent entering-condition scores and carried full-route simulation are distinct scopes: random battle outcomes must eventually update HP/PP/bag/party before later replay steps, rather than a fake executor returning success and inventing fresh snapshots. Applicability and implementation order These numbers describe the LeafGreen Pokeguy profile (Mild; selected IVs 28/25/16/31/21/27 in HP/Atk/Def/SpA/SpD/Spe order, reconciled EVs/EXP). This PR describes FireRed, defaults simulation stats to Hardy/IV15/EV0, extrapolates summary stats, and explicitly fights wild Pokémon in the Forest. Its actual levels, EVs, HP and bag therefore need reconciliation before any probability transfer. Verify version/trainer identity and route differences; do not force the real starter into the benchmark profile by assumption. Suggested sequence: add a native AutoStory planning replay that emits its battle history/preconditions/policies; add a generic importer/validator and configurable quality report in PokemonSimulation; wire the producer's B-default/C-opt-in live decisions and verified item execution to that same contract; migrate old simulation callers and remove duplicated mechanics/Monte Carlo. Then add carried replay, branch coverage and full-party/capture support, and validate implemented console stages. Keep native controller regressions in Arduino-Source and mathematical/sampling tests here. Re-estimate any changed policy/profile in PokemonSimulation. The 69 independent rates do not yet prove a continuous full-route run, and the observed pre-Champion Elixir does not establish a sufficient stochastic PP budget. |
|
Follow-up advisory for getting FRLG naming-screen PR #81 into the dependency chain: split it into two source PRs, with a separate image-fixture PR first, then consumer integration.
Fixtures and tests. Images belong in PokemonAutomation/CommandLineTests, as required by the contribution guidance. Land fixtures before standard CI for the detector needs those paths. Put the detector's At the reviewed #81 head ( Language scope. Upstream SID Helper supports Japanese through language-specific timing/navigation within the same program. I found no separate upstream FRLG Japanese naming-keyboard implementation. #81's keyboard table explicitly targets the English game. Declare that support boundary and reject unsupported layouts before sending input; a matching naming-screen detector does not establish that the keyboard layout is English. Japanese layout/character/length support can be a separate follow-up with its own fixtures and validation. Preserve the existing Japanese SID workflow rather than routing it through the English typer. Keyboard acceptance checks. Validate page transitions, cursor wraparound, repeated characters and maximum-length names on hardware. The helper assumes a freshly opened screen with an empty name, uppercase page and cursor on A; the current detector only identifies the screen and does not verify those starting conditions. Keep both public contracts: Dependency ownership matters here. At the reviewed heads, #213 ( Prepare the detector and keyboard as fork drafts, with the keyboard stacked on the detector. Sequence the upstream handoffs through the user: fixtures first, detector, then keyboard, then consumer changes. When a parent lands, merge updated main/parent into the child per the shared workflow; do not rebase or force-push this Arduino stack. This advisory is a split/validation plan, not a claim that the detector or typing timings have already been validated. |
Clean up namespace closing comments, namespace-scope symbol documentation, and refactor unit tests to table-driven TestCase scenarios.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
# Conflicts: # SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Panels.cpp # SerialPrograms/cmake/SourceFiles.cmake
* Export evaluated FRLG checkpoints without console execution * Provide offline UI flag and capture before unrelated tests
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 # Conflicts: # SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp
StoryExecutor now runs each step through a shared TableExecutor on FRLG's rows (PokemonFRLG_AutoStoryStepTable.h) instead of one virtual per kind. The rows bind to the same console actions as before; a failed console step is still the failed Outcome "operation_failed" (the default StepGuard). Tests run the rows with a recorder against the per-kind dispatch they replace, and lint every checkpoint against them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
PokemonFRLG_Tests.cpp and PokemonFRLG_AutoStory_Tests.cpp reach their length limits further down the stack, so add_tests_AutoStorySimulation() registers them. A StoryExecutor can't be copied: its table's actions point at it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
console B, 00.27, 2026-11-09: the save stood in Cerulean City below the Center's door; nothing checked it against the row's start, and the run walked as if from the counter. Red: 00.09 from a save below Pewter Center's door runs its steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Every row with a start pose gets the engine's start check (Checkpoint::start): the save it starts from, as the game reads it, must stand on the start's map and tile, and face its way when both facings are known, or the checkpoint stops with start_failed before its first step and without saving. The sim reads the fake game's save; the console has no tile reader yet, so there the check logs that nothing was read and passes, behind the save card's place check at load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The detectors move to their own PR at their latest version; stage 1 takes them from there. Conflicts: the 16 detector files stage 1 added take frlg/detectors' version; SourceFiles.cmake and PokemonFRLG_Tests.cpp keep both sides' entries, the screen events registered once with the readers. set_option() holds option_menu_name()'s std::string_view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Battle simulation moves to PokemonSimulation, whose plan for a trainer battle will come in the checkpoint JSON. Until then a battle's move is the fallback: the strongest by power x STAB x type effectiveness x accuracy (attack_slot_against(), now with accuracy), against the trainer's Pokemon out as read at the battle menu, else against its whole party. A Potion is used whenever the bar isn't green, unless the last hit took a Potion's worth. HIGH-risk battles are no longer refused before the fight. Deleted: AutoStoryBattleSim, AutoStoryWinChance, AutoStoryFoeTracker and AutoStoryDamage (Gen 3 damage, used only by them; Stats moves to PokemonFRLG_AutoStoryStats.h), BattleSim_Tests, map_trainers.json with map_trainers() and MIN_WIN_CHANCE. Supplies::foe_out is the species read. The battle-risk test moves to the BattleData tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
nav/story-steps moved AutoStoryStats& after the counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Names, test descriptions and table strings use std::string_view; the authored JSON test fixtures and the option's help text are std::string. Lines this touches build their strings with std::format. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Moves groups of declarations unchanged into chained sub-headers so each header exports at most eight names (code health's header_symbols). Each main header includes its last sub-header, so callers are unchanged. Also drops the sim-only type_multipliers() and chart_rows(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
species.json keeps each species' types; moves.json keeps each move's type,
whether it does damage and its PP (PP tracking needs it). trainers.json and
the story-trainer table are gone: a battle step's plan names its trainer and
foes ("trainer", "foes" args on FRLG's battle action). The fallback attack is
the damaging move with the best type multiplier against the foes, ties in
plan then slot order; with no foe known, the first damaging move. The
generator forwarder is removed, as nothing here regenerates these files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
#213 now sits on #352 and keeps only the recovery walk: routes and legs walk with walk_overworld_route_with_recovery() instead of the plain walker. The story-trainer check takes #352's place in the AutoStory tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…nto frlg/stage2-rng 00.04 keeps the stage's version (it hands off to Starter RNG); the rival battle now in 00.04b names TRAINER_RIVAL_OAKS_LAB_BULBASAUR and its Bulbasaur, as #213's plans do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…to frlg/stage3-mtmoon The Route 3 and Mt. Moon battles in 00.11 and 00.13 now name their trainer and party in the plan, from the trainer table #213 removed. GRIND's spec drops the beat and chance args it no longer reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…tle sim) into frlg/stage4-cerulean Detector files take frlg/detectors' versions. Cerulean's maps (Mart, Gym, Route 24/25, Sea Cottage) come from the pinned Packages resources, so the stage's map JSONs and frlg_maps.py edit go. The battle sim and win chance go with the parent's: the Potion rule is the plain one again (any bar not green, unless the foe's last hit took a Potion's worth), and an Awakening is used asleep in a trainer's battle unless the bar is red; SLP reading, Awakenings as a supply, trainer lines and once-per-save steps stay. 00.15's GRIND grinds to Lv22, where console B's Wartortle beat the rival, without the beat/chance args. Every battle step in 00.14c, 00.15b and 00.16 names its trainer and party, from the trainer table #213 removed. Stage additions to split headers go into the sub-headers; the trainer line steps get PokemonFRLG_AutoStoryTrainerLine.h and the status badge reader PokemonFRLG_AutoStoryStatusBadge.h. Files the stage had turned to LF keep the parent's CRLF. 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
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
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
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_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Depends on #352
Last part of FRLG AutoStory stage 1, now split into #350 (overworld walker and maps), #351 (battles and party) and #352 (the story program); this PR keeps only the recovery walk on top. With it, a story route or leg stopped part-way by a battle or a message is not guessed from a step count: the stop's timing narrows where the player is, run_route() finds them again on the story maps, and the walk goes on as planned (walk_overworld_route_with_recovery() in place of the plain walker). Stages 2 and later are based on this branch. Tested with the FRLG and Pokemon:: unit suites locally (all non-image tests pass) and the code-health gate.
🤖 Generated with Claude Code
https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss