Skip to content

BBQ Farmer: don't retry a failed quest every round while it stays on the panel - #1642

Closed
dayfine wants to merge 2 commits into
PokemonAutomation:mainfrom
dayfine:bbq/persistent-quest-retries
Closed

dayfine wants to merge 2 commits into
PokemonAutomation:mainfrom
dayfine:bbq/persistent-quest-retries

Conversation

@dayfine

@dayfine dayfine commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Depends on: #1632. Merge that first. Until then this PR also shows #1632's commit; the change here is the last commit only.

process_and_do_quest() gives up on a quest after NUM_RETRIES retries. But the failed quest stays on the panel, so the next round attempts it again with a fresh set of retries. A quest that can't be done, such as a sneak-up whose target never spawns, is retried forever. With NUM_RETRIES = 1 that means 2 attempts every round, indefinitely.

Change

All of this is in run_bbq_rounds(); process_and_do_quest() is unchanged.

  • A quest whose do_quest() call fails (meaning it used all of its retries) is remembered as failed and left out of later rounds. With NUM_RETRIES = 1 it gets 2 attempts in total.
  • A failed quest is forgotten once a panel read shows it gone, so it gets its attempts again if it comes back. Only a read of 4 known quests counts. The first 3 slots are always read, as UnableToDetect if OCR fails, but a 4th slot only appears when OCR reads it, so a 3-slot read may have missed a quest. A missed read must not hand a failing quest new attempts.
  • If the only doable quests left on the panel are failed ones, the farmer logs why and stops instead of spending BP to reroll them. Choosing a different action for this case is out of scope here.

Tests

4 new PokemonSV::BBQFarmerRounds scenarios, run against the simulated quest panel from #1632. The fake can now have quests that never complete, and a custom list of quests that replace completed ones.

Scenario What it checks
failed quest is not attempted again sneak-up fails in round 1 and is skipped in round 2
stops when only failed quests are doable the farmer stops before round 2 dispatches anything
failed quest that leaves a full panel is attempted again after a 4-slot read without sneak-up, it is attempted again when it returns
failed quest missing from a 3-slot panel stays failed the same sequence on 3 slots keeps it failed

All 10 farmer-round scenarios pass.

This replaces the earlier version. That version passed an optional retry tracker into process_and_do_quest(), used forward declarations and #pragma once, and had Python replay tests that compiled pieces of production code cut out of the source by text matching. The live smoke run it reported (3 quests completed on the first attempt) never reached the failed-quest path. No live run of the failed path has been done for this version either.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

dayfine and others added 2 commits October 20, 2026 22:02
BBQSoloFarmer::program() runs its quest rounds inline against the
console, so the round logic (which quests count, when to stop, when to
save) can only be exercised by running the farmer on a Switch.

Move the round loop into run_bbq_rounds(), which takes the game actions
it depends on as a BBQGameActions interface: read the quests, process
them, do a quest, report a completed quest, and end the round (saving
if due). BBQSoloFarmer implements these with the calls they replace, in
the same order; the date fix, save/reset, stats and notification move
together into end_round(). Startup, flying to the plaza and
end-of-program handling stay in program(). The commented-out
single-quest debug block declares its own egg counter now that the loop
locals have moved.

process_quest_list() only reads its quest list and egg count, so take
them as const& and by value.

Add PokemonSV::BBQFarmerRounds, a table of scenarios run against a
simulated singleplayer quest panel: 3 blue quests, completed quests are
replaced, impossible quests are skipped, and a panel with nothing doable
is rerolled. Each scenario checks the number of completed quests and the
exact action sequence: finishing the round that reaches the goal, a
quest already gone, a failed quest, a panel with nothing doable, saving
at exact multiples, and stopping when out of eggs. No behavior
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
process_and_do_quest() gives up on a quest after NUM_RETRIES retries,
but the quest stays on the panel, so the next round attempts it again
with a fresh set of retries. A quest that cannot be done, such as a
sneak-up whose target does not spawn, is retried forever.

run_bbq_rounds() now remembers quests that failed all their attempts
and leaves them out of later rounds. A quest is forgotten once a read
of 4 known quests shows it gone, so it gets its attempts again if it
comes back. If only failed quests are doable, the farmer stops instead
of spending BP to reroll them.

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

dayfine commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing for now to keep the upstream queue to PRs that are ready: this one waits on unmerged parent PRs. It continues on my fork as dayfine#6, and I'll reopen it here once its parents merge.

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