Skip to content

BBQ Farmer: stop instead of rerolling the quest panel forever - #1639

Closed
dayfine wants to merge 2 commits into
PokemonAutomation:mainfrom
dayfine:bbq/endless-reroll-guard
Closed

dayfine wants to merge 2 commits into
PokemonAutomation:mainfrom
dayfine:bbq/endless-reroll-guard

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.

When nothing on the quest panel is doable, the BBQ Farmer rerolls the whole panel and reads it again. If nothing can ever become doable, it does this forever, spending BP on every reroll. This PR stops the program with a setup error in that case.

Change

  • Startup check: run_bbq_rounds() throws UserSetupError before reading the panel if the exclusions table skips or rerolls every blue quest the program can do (blue quests minus not_possible_quests). A quest counts as doable when any table row for it says Run, which matches how process_quest_list() treats duplicate rows.
  • Read limit: after 30 panel reads in a row with nothing doable, it throws UserSetupError telling the user to check the game language and their BP. If the language is wrong, every quest reads as UnableToDetect. If BP runs out, rerolls stop changing the panel.

Why 30: with valid settings, a panel can have nothing doable and the next reroll fixes it. In a bad case where only 3 of the 31 blue quests are doable, a panel has nothing doable 73% of the time, so 30 such panels in a row happen with probability 0.008%. With the defaults (28 doable) the chance per panel is 0.02%.

Tests

There are 3 new PokemonSV::BBQFarmerRounds scenarios that run through the simulated quest panel from #1632. The panel can now be out of BP, meaning rerolls do nothing.

Scenario Expected
fails at start when every blue quest is excluded error before any panel read
a quest with a run row is not excluded all quests skipped except make-tm, which has a Run row, so the run proceeds
gives up when rerolling does not help 30 × (read, process), then error

All 9 farmer-round scenarios pass. Without this change, the first and third scenarios fail.

🤖 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
When nothing on the panel is doable the farmer rerolls it and reads it
again. If nothing can ever become doable, the loop never ends.

Check at start that the exclusions table leaves at least one doable
blue quest, and give up with a UserSetupError after 30 reads in a row
with nothing doable (wrong game language, or no BP left to reroll).

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#5, and I'll reopen it here once its parents merge.

@dayfine dayfine closed this Oct 22, 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