Skip to content

BBQ Farmer: exclude the BP suffix from balance OCR - #1628

Merged
kichithewolf merged 1 commit into
PokemonAutomation:mainfrom
dayfine:bbq/bp-reader-crop
Oct 28, 2026
Merged

kichithewolf merged 1 commit into
PokemonAutomation:mainfrom
dayfine:bbq/bp-reader-crop

Conversation

@dayfine

@dayfine dayfine commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

The BP balance OCR read 6750 as 67501 because the crop caught the edge of the "BP" suffix. This narrows the crop and moves the read into read_BP_from_image() so it can be tested. It adds 4 cases in PokemonSV::BlueberryPoints (1080p and 720p) on two reference screenshots, which go to CommandLineTests under PokemonSV/BlueberryPoints/ (PokemonAutomation/CommandLineTests#36); with the old crop all four fail.

Part of PokemonAutomation/ComputerControl#263.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

@dayfine

dayfine commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@jw098 PTAL

@dayfine
dayfine force-pushed the bbq/bp-reader-crop branch from 486c0da to c2fde24 Compare October 26, 2026 17:55
@jw098

jw098 commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Your UnitTestsResources need to be uploaded to the CommandLineTests repo. That's where the CI pulls its tests from. Don't upload the test images to this repo.

@dayfine

dayfine commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks, moved the two images and their README to PokemonAutomation/CommandLineTests#36 (under PokemonSV/BlueberryPoints/) and dropped UnitTestResources/ from this PR. The tests still load them through UNIT_TEST_RESOURCE_PATH(), so CI should pick them up once that PR is merged.

Mysticial pushed a commit to PokemonAutomation/CommandLineTests that referenced this pull request Oct 27, 2026
Two unmodified 1920x1080 frames (6750 and 6740 BP, one reroll apart)
for the PokemonSV::BlueberryPoints unit tests in
PokemonAutomation/Arduino-Source#1628.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit to dayfine/Arduino-Source that referenced this pull request Oct 27, 2026
The BBQ Farmer counts quests but not what they are worth, so a change to
the program can't be judged by the BP it makes per hour.

read_quests() already screenshots the quest panel, which shows the BP
balance in its corner. It now takes an optional out-parameter and reads
the balance from that same screenshot with the reader from
PokemonAutomation#1628, so no button presses are added.
The farmer passes it at both of its quest reads and feeds each balance
into a small BBQPointsLedger: a rise between two reads is earned, a drop
(a reroll) is spent, and OCR failures (-1) are skipped. One extra
read_BP() after the last batch picks up its reward.

The stats show "BP Earned" and "BP Spent" as saved counters, plus a
derived "Net BP" and, for the current run, "BP/hour" over the span
between the first and latest reads. The derived values are not written
to the stats file.

Add data-driven PokemonSV::BBQPointsLedger unit tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit to dayfine/Arduino-Source that referenced this pull request Oct 27, 2026
# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonSV/PokemonSV_Tests.cpp
dayfine added a commit to dayfine/Arduino-Source that referenced this pull request Oct 27, 2026
The BBQ Farmer counts quests but not what they are worth, so a change to
the program can't be judged by the BP it makes per hour.

read_quests() already screenshots the quest panel, which shows the BP
balance in its corner. It now takes an optional out-parameter and reads
the balance from that same screenshot with the reader from
PokemonAutomation#1628, so no button presses are added.
BBQSoloFarmerGameActions passes it at every quest read, including the
reads inside a reroll, and feeds each balance into a small
BBQPointsLedger: a rise between two reads is earned, a drop (a reroll)
is spent, and OCR failures (-1) are skipped. The BP read that decides
whether a quest not possible can be rerolled is recorded too, and one
extra read_BP() after the last batch picks up its reward.

The stats show "BP Earned" and "BP Spent" as saved counters, plus a
derived "Net BP" and, for the current run, "BP/hour" over the span
between the first and latest reads. The derived values are not written
to the stats file.

read_quests() now opens the panel with open_quest_panel(), which presses
the same buttons and waits for the same watcher, instead of its own
copy, to stay under the function length limit.

Add data-driven PokemonSV::BBQPointsLedger unit tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The Blueberry Points crop ended at x=0.957, which included the left
stroke of the "B" in the "BP" suffix. PaddleOCR read it as an extra
digit, so a balance of 6750 came back as 67501.

Narrow the crop to end at x=0.954 and move the reader into
Inference/PokemonSV_BlueberryPointsReader so it can be tested from a
captured frame without depending on the BBQ program code. read_BP()
still opens and closes the panel and delegates to the shared reader.

Register four PokemonSV::BlueberryPoints unit tests at 1920x1080 and
1280x720 on two full-frame reference screenshots (6750 and 6740 BP,
taken one reroll apart). The images go to the CommandLineTests repo
under PokemonSV/BlueberryPoints/. With the old crop restored, all four
fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
@dayfine
dayfine force-pushed the bbq/bp-reader-crop branch from 39ba660 to 2aedcd0 Compare October 28, 2026 06:00
dayfine added a commit to dayfine/Arduino-Source that referenced this pull request Oct 28, 2026
dayfine added a commit to dayfine/Arduino-Source that referenced this pull request Oct 28, 2026
The BBQ Farmer counts quests but not what they are worth, so a change to
the program can't be judged by the BP it makes per hour.

read_quests() already screenshots the quest panel, which shows the BP
balance in its corner. It now takes an optional out-parameter and reads
the balance from that same screenshot with the reader from
PokemonAutomation#1628, so no button presses are added.
BBQSoloFarmerGameActions passes it at every quest read, including the
reads inside a reroll, and feeds each balance into a small
BBQPointsLedger: a rise between two reads is earned, a drop (a reroll)
is spent, and OCR failures (-1) are skipped. The BP read that decides
whether a quest not possible can be rerolled is recorded too, and one
extra read_BP() after the last batch picks up its reward.

The stats show "BP Earned" and "BP Spent" as saved counters, plus a
derived "Net BP" and, for the current run, "BP/hour" over the span
between the first and latest reads. The derived values are not written
to the stats file.

read_quests() now opens the panel with open_quest_panel(), which presses
the same buttons and waits for the same watcher, instead of its own
copy, to stay under the function length limit.

Add data-driven PokemonSV::BBQPointsLedger unit tests, with the other BBQ
tests in PokemonSV_BBQTests.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
@kichithewolf
kichithewolf merged commit 2eba082 into PokemonAutomation:main Oct 28, 2026
7 checks passed
dayfine added a commit to dayfine/Arduino-Source that referenced this pull request Oct 30, 2026
main moved the quest token map, BBQuests_string_to_enum/enum_to_string and
CameraAngle out of BlueberryQuests (PokemonAutomation#1631), and the BP crop into
read_BP_from_image (PokemonAutomation#1628). Took main's versions and kept only this branch's
log_bbq_snapshot() in BlueberryQuests; BlueberryCatchPhoto.cpp now includes
BlueberryQuests.h directly, since its header no longer pulls it in. Unknown
quests now log as an empty slug (main's enum_to_string) instead of "unknown".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
@dayfine
dayfine deleted the bbq/bp-reader-crop branch November 3, 2026 05:46
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.

3 participants