Skip to content

AutoStory: shared checkpoint range options - #325

Draft
dayfine wants to merge 27 commits into
autostory/r3-shared-statsfrom
autostory/story-range-options
Draft

dayfine wants to merge 27 commits into
autostory/r3-shared-statsfrom
autostory/story-range-options

Conversation

@dayfine

@dayfine dayfine commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Base: autostory/r3-shared-stats (#45); the diff shows only this change. Parent of #114, which merges it in.

What the user picks, shared by every AutoStory program: StoryRangeOptions is the start/end checkpoint dropdown group with the check that the start does not come after the end, so SV (#320) and the story engine's programs use one copy. story_checkpoint_database() builds those dropdowns from a game's checkpoint labels and sits next to make_story_select_database() in Pokemon_AutoStorySelect.h, with a test beside that function's; the log lines and stats counts that used to be here are now in #45. Tested with a local build and the unit test runner: the StoryRangeOptions and AutoStorySelect suites and the other Pokemon:: suites pass; fork CI dispatched on Windows, Windows clang, Ubuntu and Mac.

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

…#320)

StoryLog (checkpoint log lines, stats counts) and StoryRangeOptions (the
start/end checkpoint dropdowns, story_checkpoint_database()) moved
unchanged from #312, so the SV program (#320) and the engine (#114) can
share them without the story engine. story_checkpoint_database() now takes
the checkpoints' labels instead of StoryCheckpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…ge-options

The log lines and story counts now live in #45: keep #45's StoryLog,
AutoStoryStats and their tests, drop this branch's copies. The range
option tests get their own header, Pokemon_StoryRangeOptions_Tests.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine added a commit that referenced this pull request Nov 10, 2026
Move the checkpoint log line formatters (Pokemon_StoryLog) and their tests
here from #325, and put StoryRunCounts and record_story_counts() with
AutoStoryStats, which they add to. StoryLog now holds only log lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine and others added 3 commits November 10, 2026 13:29
It builds a dropdown database like make_story_select_database(), so it
lives next to it in Pokemon_AutoStorySelect.h (header-only, inline) with
a test beside that function's. StoryRangeOptions keeps only the option
group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…select test

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

Brings in #312's typed step args (StoryArgs gave way to StoryActionArg
there) and #45/#325's split of StoryLog, AutoStoryStats and the range
options. Conflicts were only the file and test registration lists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
@dayfine dayfine changed the title AutoStory: shared StoryLog and StoryRangeOptions (prep) AutoStory: shared checkpoint range options Nov 10, 2026
The tutorial and main story checkpoint dropdowns are now the shared
StoryRangeOptions, added under the same keys (START_CHECKPOINT_TUTORIAL,
END_CHECKPOINT_TUTORIAL, START_CHECKPOINT_MAINSTORY, END_CHECKPOINT_MAINSTORY)
over the same databases, so saved settings load unchanged; the end stays
unlocked while running. The start-before-end check is the range's. The
checkpoint loops log the shared attempt and reset lines, and the run logs
the shared checkpoint start line.

Rebased onto autostory/story-range-options (#325) and squashed: it
uses only the shared range options (#325) and log lines (#45), not #312.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine and others added 7 commits November 11, 2026 21:38
…tory-options

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…tory-options

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

Folded leaf PR #320; tree equals the leaf tip.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
#include "ML/Inference/ML_YOLONavigation.h"
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
#include "Pokemon/AutoStory/Pokemon_AutoStoryStats.h"
#include "Pokemon/AutoStory/Pokemon_StoryLog.h"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be included in the .cc fille? then we can keep the header unchanged?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The Pokemon_StoryLog.h include now sits in PokemonSV_AutoStoryTools.cpp and PokemonSV_AutoStory.cpp, not the header (#45, 1e49c4f). #325 drops it from the header in d24b86d, so this PR no longer touches PokemonSV_AutoStoryTools.h. In #45 the header still changes one line: checkpoint_text() loses its "Checkpoint:: " prefix, since the [Checkpoint] log line adds it now, and that needs <format>.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this change should be part of #45?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to #45 (1e49c4f): the checkpoint loops' attempt and reset lines now use Pokemon_StoryLog. #45 also drops one blank line in each of the two legacy SV files so their line counts don't grow (code health, 1b5aaf0). #325 merged #45 in (036d1d3), and its diff no longer has this file.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the log check here should be made in #45

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to #45 (1e49c4f): the "Start Checkpoint" line is now checkpoint_start_line(), with its include. #325 merged #45 in (036d1d3), so this file's diff here is only the range options now.

std::string describe_entries(const std::vector<std::pair<std::string, std::string>>& entries){
std::string text;
for (const auto& [slug, label] : entries){
text += std::format("{}{} \"{}\"", text.empty() ? "" : ", ", slug, label);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a StrJoin function that avoid repeated append?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, Common/Cpp/Strings (StringTools, Unicode) has no join helper, and nothing else in the repo has one. C++23 std::views::join_with would do it, but older libc++ (the Mac CI's Xcode) doesn't have it yet, so I left this loop as it is. It's a small test-only helper. A shared join in StringTools would be its own PR.

// section's entry i is then story_index(true, i, first of the section).
// The program keeps it in a function-local static: the options hold a
// reference.
inline StringSelectDatabase story_checkpoint_database(std::span<const std::string> labels){

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not directly related here: but what if there are multiple orders, e.g. in FRLG for different starter choice? would that work with here?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for FRLG's starter choice. The starter doesn't change the order of checkpoints: every starter goes through the same story beats. Only what happens inside some of them changes, such as which ball to walk to and the rival's team. Today FRLG has one table (story_checkpoints()) and assumes Squirtle (TODO at PokemonFRLG_AutoStory.cpp:457). A starter option would feed into those events and battle data, as SV's STARTERCHOICE does, and this dropdown stays as it is.

It would break for a game whose order really branches, with different checkpoints per choice. The slugs are list indices, so a saved "12" would point at a different checkpoint in another order. The database is also a function-local static, so it can't follow an option change. The smallest fix is to keep one list with every branch's checkpoints and skip the ones that don't apply at run time, the way FRLG already joins or skips handoff rows. If we ever need several real lists, slug by checkpoint id ("01.05") instead of index, so saved settings stay valid. That isn't a one-liner, so I haven't done it here.

dayfine added a commit that referenced this pull request Nov 13, 2026
SV's checkpoint loops and its start line use Pokemon_StoryLog's format
(moved here from #325, as asked in review). The log header is included
from the .cpp files, not AutoStoryTools.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine and others added 7 commits November 13, 2026 13:55
…ions: optional display text on [Checkpoint] lines
…ions: StoryRunCounts moves to #114

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…dd_checkpoint_prefix (#45)

Conflict in PokemonSV_AutoStoryTools.cpp reset lines: took #45's add_checkpoint_prefix form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
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