gameboy_worlds.emulation.sword_of_hope.trackers

   1from gameboy_worlds.emulation.tracker import (
   2    StateTracker,
   3    TestTrackerMixin,
   4    DummySubGoalMetric,
   5    make_subgoal_metric_class,
   6)
   7from gameboy_worlds.emulation.sword_of_hope.base_metrics import SwordOfHopeOCRMetric
   8from gameboy_worlds.emulation.sword_of_hope.test_metrics import (
   9    SoH2DialogueClearedTerminateMetric,
  10    SoH2DialogueActiveSubGoal,
  11    SoH2DialogueAdvancedTerminateMetric,
  12    SoH2DialogueInitiatedSubGoal,
  13    SoH2ExplorationMenuTerminateMetric,
  14    SoH2PowerMenuLastSlideSubGoal,
  15    SoH2BattleWonTerminateMetric,
  16    SoH2BattleActiveSubGoal,
  17    SoH2EscapeConfirmedTerminateMetric,
  18    SoH2WheatPurchasedTerminateMetric,
  19    SoH2ShopMenuOpenTerminateMetric,
  20    SoH2ShopMenuOpenSubGoal,
  21    SoH2BattleMagicMenuTerminateMetric,
  22    SoH2MotionResultTerminateMetric,
  23    SoH2MagicMenuOpenSubGoal,
  24    SoH2LookTargetSubGoal,
  25    SoH2CprSwordPurchasedTerminateMetric,
  26    SoH2WeaponsShopMenuOpenSubGoal,
  27    SoH2LookShopkeeperSubGoal,
  28    SoH2ShopBuySellMenuSubGoal,
  29    SoH2CursorOnCprSwordSubGoal,
  30    SoH2CursorOnAutoTerminateMetric,
  31    SoH2WheatFromTreeTerminateMetric,
  32    SoH2HitTreeTargetSubGoal,
  33    SoH2UseMenuOpenTerminateMetric,
  34    SoH2ItemMenuOpenSubGoal,
  35    SoH2UseMenuOpenSubGoal,
  36    SoH2WheatConsumedTerminateMetric,
  37    SoH2CursorOnWheatSubGoal,
  38    SoH2PowerStatsExpPageTerminateMetric,
  39    SoH2CursorOnPowerSubGoal,
  40    SoH2PowerStatsFirstPageSubGoal,
  41    SoH2CursorOnLookTerminateMetric,
  42    SoH2CursorOnItemTerminateMetric,
  43    SoH2CursorOnOpenTerminateMetric,
  44    SoH2CursorOnMagicTerminateMetric,
  45    SoH2CursorOnHitTerminateMetric,
  46    SoH2CursorOnPowerTerminateMetric,
  47    SoH2CursorOnLookSubGoal,
  48    SoH2CursorOnItemSubGoal,
  49    SoH2CursorOnOpenSubGoal,
  50    SoH2CursorOnMagicSubGoal,
  51    SoH2CursorOnHitSubGoal,
  52    SoH2DialogueVisibleSubGoal,
  53    SoH2FirstAdjacentRoomTerminateMetric,
  54    SoH2StarterRoomSubGoal,
  55    SoH2PowerStatsFirstPageTerminateMetric,
  56    SoH2MagicMenuOpenTerminateMetric,
  57    SoH2ItemMenuOpenTerminateMetric,
  58    SoH2LookShopkeeperTerminateMetric,
  59    SoH2WeaponsShopMenuOpenTerminateMetric,
  60    SoH2CursorOnCprSwordTerminateMetric,
  61    SoH2ShopBuySellMenuTerminateMetric,
  62    SoH2CursorOnWheatTerminateMetric,
  63    SoH2CursorOnClashTerminateMetric,
  64    SoH2Temple1fTerminateMetric,
  65    SoH2OutsideTempleSubGoal,
  66    MillRoomTerminateMetric,
  67    ShamanRoomTerminateMetric,
  68    DialogueClearedTerminateMetric,
  69    BattleWonTerminateMetric,
  70    ItemFoundTerminateMetric,
  71    PurchaseConfirmedTerminateMetric,
  72    ExplorationMenuTerminateMetric,
  73    DialogueAdvancedTerminateMetric,
  74    BattleMagicMenuTerminateMetric,
  75    TeleportResultTerminateMetric,
  76    MistressSecondDialogueTerminateMetric,
  77    SaveConfirmedTerminateMetric,
  78    HerbReceivedTerminateMetric,
  79    TreantDefeatedTerminateMetric,
  80    GateOpenedTerminateMetric,
  81    ScrollReceivedTerminateMetric,
  82    CharmReceivedTerminateMetric,
  83    TeleportLandedTerminateMetric,
  84    EscapeConfirmedTerminateMetric,
  85    CursorOnLookTerminateMetric,
  86    CursorOnOpenTerminateMetric,
  87    CursorOnUseTerminateMetric,
  88    CursorOnMagicTerminateMetric,
  89    CursorOnHitTerminateMetric,
  90    CursorOnPowerTerminateMetric,
  91    PowerStatsFirstPageTerminateMetric,
  92    CursorOnAutoTerminateMetric,
  93    ShopMenuOpenTerminateMetric,
  94    LookSelectedTerminateMetric,
  95    MenuOpenTerminateMetric,
  96    MagicMenuOpenTerminateMetric,
  97    DialogueInitiatedTerminateMetric,
  98    BattleActiveTerminateMetric,
  99    TeleportDestCursorTerminateMetric,
 100    LookTargetOptionsTerminateMetric,
 101    CursorOnFirebalTerminateMetric,
 102    CursorOnFirebal2TerminateMetric,
 103    CursorOnStripallTerminateMetric,
 104    CursorOnFirebalSubGoal,
 105    CursorOnFirebal2SubGoal,
 106    CursorOnStripallSubGoal,
 107    CursorOnTeleportOldmanTerminateMetric,
 108    CursorOnHerbUseTerminateMetric,
 109    CursorOnKeymUseTerminateMetric,
 110    OldmanHouseTerminateMetric,
 111    PowerStatsLastPageSubGoal,
 112    CursorOnTeleportOldmanSubGoal,
 113    PowerStatsFirstPageSubGoal,
 114    BattleMagicMenuSubGoal,
 115    SoH2BattleActiveTerminateMetric,
 116    SoH2CursorOnMotionTerminateMetric,
 117    SoH2CursorOnTheoSubGoal,
 118    SoH2PowerStatsExpPageSubGoal,
 119    SoH2CursorOnShopFirstItemTerminateMetric,
 120    SoH2CursorOnShopFirstItemSubGoal,
 121    SoH2CursorOnShopThirdItemTerminateMetric,
 122    SoH2CursorOnFirstWeaponTerminateMetric,
 123    SoH2CursorOnFirstWeaponSubGoal,
 124    SoH2CursorOnSecondWeaponTerminateMetric,
 125    SoH2CursorOnSecondWeaponSubGoal,
 126    SoH2CursorOnThirdWeaponTerminateMetric,
 127    SoH2LookTreeTargetTerminateMetric,
 128    SoH2BattleMagicMenuSubGoal,
 129    SoH2CursorOnAutoSubGoal,
 130    SoH2CursorOnClashSubGoal,
 131    OldmanHouseSubGoal,
 132    InForestSubGoal,
 133    ShamanHouseSubGoal,
 134    DialogueActiveSubGoal,
 135    BattleActiveSubGoal,
 136    LookSelectedSubGoal,
 137    LookTargetOptionsSubGoal,
 138    ShopMenuOpenSubGoal,
 139    DialogueVisibleSubGoal,
 140    DialogueInitiatedSubGoal,
 141    MenuOpenSubGoal,
 142    MagicMenuOpenSubGoal,
 143    MistressFirstDialogueSubGoal,
 144    SavePromptVisibleSubGoal,
 145    LookPathTargetSubGoal,
 146    HitTargetShownSubGoal,
 147    HitWallTargetSubGoal,
 148    KeyMSelectedSubGoal,
 149    InBackroomSubGoal,
 150    GraceSelectedSubGoal,
 151    TeleportDestCursorSubGoal,
 152    CursorOnLookSubGoal,
 153    CursorOnOpenSubGoal,
 154    CursorOnUseSubGoal,
 155    CursorOnMagicSubGoal,
 156    CursorOnHitSubGoal,
 157    CursorOnPowerSubGoal,
 158)
 159
 160
 161class SwordOfHopeOCRTracker(StateTracker):
 162    """
 163    Base StateTracker that always captures the full Game Boy screen as an OCR region.
 164    Used as the default tracker for both Sword of Hope 1 and Sword of Hope 2 so that
 165    OCR-eligible captures are always available for downstream agents.
 166    """
 167
 168    def start(self):
 169        super().start()
 170        self.metric_classes.append(SwordOfHopeOCRMetric)
 171
 172
 173class SwordOfHope1TestTracker(TestTrackerMixin, SwordOfHopeOCRTracker):
 174    """
 175    Base TestTracker for Sword of Hope 1.
 176    Inherit this class and set TERMINATION_TRUNCATION_METRIC to create task-specific trackers.
 177    """
 178
 179    TERMINATION_TRUNCATION_METRIC = MillRoomTerminateMetric
 180    SUBGOAL_METRIC = DummySubGoalMetric
 181
 182
 183class SwordOfHope2TestTracker(TestTrackerMixin, SwordOfHopeOCRTracker):
 184    """
 185    Base TestTracker for Sword of Hope 2.
 186    Inherit this class and set TERMINATION_TRUNCATION_METRIC to create task-specific trackers.
 187    """
 188
 189    TERMINATION_TRUNCATION_METRIC = None
 190    SUBGOAL_METRIC = DummySubGoalMetric
 191
 192
 193class SwordOfHope2DialogueClearTestTracker(SwordOfHope2TestTracker):
 194    """
 195    Terminates when the dialogue is cleared and control returns to the player.
 196    Subgoals: dialogue_active -> (termination) dialogue_cleared.
 197    """
 198
 199    TERMINATION_TRUNCATION_METRIC = SoH2DialogueClearedTerminateMetric
 200    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2DialogueActiveSubGoal])
 201
 202
 203class SwordOfHope2TalkToNpcTestTracker(SwordOfHope2TestTracker):
 204    """
 205    Terminates when the agent talks to an NPC and advances one full dialogue page.
 206    Subgoals: dialogue_initiated -> (termination) dialogue_advanced.
 207    """
 208
 209    TERMINATION_TRUNCATION_METRIC = SoH2DialogueAdvancedTerminateMetric
 210    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2DialogueInitiatedSubGoal])
 211
 212
 213class SwordOfHope2MenuOpenCloseTestTracker(SwordOfHope2TestTracker):
 214    """
 215    Terminates when the agent closes the Power menu and returns to exploration.
 216    Starts at default.state (exploration menu showing). The agent must navigate
 217    cursor onto Power, open Power, cycle through stat slides, then press B to
 218    close back to exploration.
 219    Subgoals: power_menu_last_slide -> (termination) exploration_menu.
 220    """
 221
 222    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
 223    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2PowerMenuLastSlideSubGoal])
 224
 225
 226class SwordOfHope2FirstAdjacentRoomTestTracker(SwordOfHope2TestTracker):
 227    """
 228    Terminates when the agent reaches Riccar Castle (first adjacent room from
 229    the King's Room). Subgoal: kings_room starting room visible.
 230    """
 231
 232    TERMINATION_TRUNCATION_METRIC = SoH2FirstAdjacentRoomTerminateMetric
 233    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2StarterRoomSubGoal])
 234
 235
 236class SwordOfHope2BattleWonTestTracker(SwordOfHope2TestTracker):
 237    """
 238    Terminates when the agent wins a battle in SoH2.
 239    Starts at battle_example.state (battle active at t=0).
 240    Subgoals: battle_active -> (termination) battle_won.
 241    """
 242
 243    TERMINATION_TRUNCATION_METRIC = SoH2BattleWonTerminateMetric
 244    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])
 245
 246
 247class SwordOfHope2EscapeBattleTestTracker(SwordOfHope2TestTracker):
 248    """
 249    Terminates when the agent successfully escapes from a battle in SoH2.
 250    Starts at battle_example.state (battle active at t=0).
 251    Subgoals: battle_active -> (termination) escape_confirmed.
 252    """
 253
 254    TERMINATION_TRUNCATION_METRIC = SoH2EscapeConfirmedTerminateMetric
 255    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])
 256
 257
 258class SwordOfHope2OpenShopMenuTestTracker(SwordOfHope2TestTracker):
 259    """
 260    Terminates when the agent opens a shop's buy menu.
 261    Starts at shop_example.state (player in front of a shop).
 262    No subgoals (single-step interaction).
 263    """
 264
 265    TERMINATION_TRUNCATION_METRIC = SoH2ShopMenuOpenTerminateMetric
 266    SUBGOAL_METRIC = DummySubGoalMetric
 267
 268
 269class SwordOfHope2BattleMagicCommandTestTracker(SwordOfHope2TestTracker):
 270    """
 271    Terminates when the agent selects MAGIC in battle and the magic submenu shows.
 272    Starts at battle_example.state.
 273    Subgoals: battle_active -> (termination) battle_magic_menu.
 274    """
 275
 276    TERMINATION_TRUNCATION_METRIC = SoH2BattleMagicMenuTerminateMetric
 277    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])
 278
 279
 280class SwordOfHope2AutoBattleTestTracker(SwordOfHope2TestTracker):
 281    """
 282    Terminates when the agent navigates the cursor onto the AUTO command in
 283    the battle command row. Tests command-row navigation.
 284    Starts at battle_example.state.
 285    Subgoals: battle_active -> (termination) cursor_on_auto.
 286    """
 287
 288    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnAutoTerminateMetric
 289    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])
 290
 291
 292class SwordOfHope2OpenItemMenuTestTracker(SwordOfHope2TestTracker):
 293    """
 294    Terminates when the agent reaches the Use submenu via Item -> Use chain.
 295    SoH2 inventory flow: press ITEM (inventory list) -> press A on an item to
 296    bring up the Use submenu.
 297    Starts at default.state.
 298    Subgoals: item_menu_open -> (termination) use_menu_open.
 299    """
 300
 301    TERMINATION_TRUNCATION_METRIC = SoH2UseMenuOpenTerminateMetric
 302    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ItemMenuOpenSubGoal])
 303
 304
 305class SwordOfHope2CursorOnLookTestTracker(SwordOfHope2TestTracker):
 306    """Cursor at LOOK in the exploration command grid. Region: status_command."""
 307    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnLookTerminateMetric
 308    SUBGOAL_METRIC = DummySubGoalMetric
 309
 310
 311class SwordOfHope2CursorOnItemTestTracker(SwordOfHope2TestTracker):
 312    """Cursor at ITEM in the exploration command grid."""
 313    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnItemTerminateMetric
 314    SUBGOAL_METRIC = DummySubGoalMetric
 315
 316
 317class SwordOfHope2CursorOnOpenTestTracker(SwordOfHope2TestTracker):
 318    """Cursor at OPEN in the exploration command grid."""
 319    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnOpenTerminateMetric
 320    SUBGOAL_METRIC = DummySubGoalMetric
 321
 322
 323class SwordOfHope2CursorOnMagicTestTracker(SwordOfHope2TestTracker):
 324    """Cursor at MAGIC in the exploration command grid."""
 325    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnMagicTerminateMetric
 326    SUBGOAL_METRIC = DummySubGoalMetric
 327
 328
 329class SwordOfHope2CursorOnHitTestTracker(SwordOfHope2TestTracker):
 330    """Cursor at HIT in the exploration command grid."""
 331    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnHitTerminateMetric
 332    SUBGOAL_METRIC = DummySubGoalMetric
 333
 334
 335class SwordOfHope2CycleThroughCommandsTestTracker(SwordOfHope2TestTracker):
 336    """
 337    Terminates when the agent has cycled the cursor through all 6 commands
 338    in order (LOOK -> ITEM -> OPEN -> MAGIC -> HIT -> POWER) without pressing
 339    A on any of them.
 340    Starts at default.state.
 341    Subgoals: cursor_on_look -> cursor_on_item -> cursor_on_open
 342              -> cursor_on_magic -> cursor_on_hit
 343              -> (termination) cursor_on_power.
 344    """
 345
 346    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnPowerTerminateMetric
 347    SUBGOAL_METRIC = make_subgoal_metric_class(
 348        [
 349            SoH2CursorOnLookSubGoal,
 350            SoH2CursorOnItemSubGoal,
 351            SoH2CursorOnOpenSubGoal,
 352            SoH2CursorOnMagicSubGoal,
 353            SoH2CursorOnHitSubGoal,
 354        ]
 355    )
 356
 357
 358class SwordOfHope2ViewExpNeededTestTracker(SwordOfHope2TestTracker):
 359    """
 360    Terminates when the agent reaches the Power stats page that shows
 361    "X more EXP needed for level up". Full chain: navigate to Power in
 362    command grid -> open Power menu (first stats page) -> cycle to last
 363    EXP page.
 364    Starts at lvl3_overworld.state (Theo at lvl 3, stable overworld).
 365    Subgoals: cursor_on_power -> power_stats_first_page
 366              -> (termination) power_stats_exp_page.
 367    """
 368
 369    TERMINATION_TRUNCATION_METRIC = SoH2PowerStatsExpPageTerminateMetric
 370    SUBGOAL_METRIC = make_subgoal_metric_class(
 371        [SoH2CursorOnPowerSubGoal, SoH2PowerStatsFirstPageSubGoal]
 372    )
 373
 374
 375class SwordOfHope2UseWheatTestTracker(SwordOfHope2TestTracker):
 376    """
 377    Terminates when the agent uses Wheat from inventory and consumes it.
 378    Full chain: ITEM submenu -> cursor on Wheat -> press A (Use submenu) ->
 379    confirm USE -> wheat consumption dialogue.
 380    Starts at wheat_in_inventory.state (player has Wheat in inventory at a
 381    stable overworld position).
 382    Subgoals: item_menu_open -> cursor_on_wheat -> use_menu_open
 383              -> (termination) wheat_consumed.
 384    """
 385
 386    TERMINATION_TRUNCATION_METRIC = SoH2WheatConsumedTerminateMetric
 387    SUBGOAL_METRIC = make_subgoal_metric_class(
 388        [SoH2ItemMenuOpenSubGoal, SoH2CursorOnWheatSubGoal, SoH2UseMenuOpenSubGoal]
 389    )
 390
 391
 392class SwordOfHope2HitTreeWheatTestTracker(SwordOfHope2TestTracker):
 393    """
 394    Terminates when the agent uses Hit on a tree at Riccar Woods [A4] and
 395    receives Wheat. Wheat drops are randomized — may take 1, 2, or more
 396    hits — so the agent must keep Hitting until the wheat dialogue appears.
 397    Starts at hit_tree_example.state (player adjacent to the [A4] tree).
 398    Subgoals: hit_tree_target -> (termination) wheat_from_tree.
 399    """
 400
 401    TERMINATION_TRUNCATION_METRIC = SoH2WheatFromTreeTerminateMetric
 402    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2HitTreeTargetSubGoal])
 403
 404
 405class SwordOfHope2CastMotionTestTracker(SwordOfHope2TestTracker):
 406    """
 407    Terminates when the agent casts Motion magic from the overworld.
 408    Starts at lvl2_overworld.state (Theo at level 2 with Motion spell available).
 409    Subgoals: magic_menu_open -> (termination) motion_result.
 410    """
 411
 412    TERMINATION_TRUNCATION_METRIC = SoH2MotionResultTerminateMetric
 413    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2MagicMenuOpenSubGoal])
 414
 415
 416class SwordOfHope2BuyWheatTestTracker(SwordOfHope2TestTracker):
 417    """
 418    Terminates when the agent buys Wheat from a shop in SoH2.
 419    Starts at shop_example.state (player in front of a shop, ready to interact).
 420    Wheat is item-specific because the post-buy dialogue contains the item name
 421    ("WHEAT? Thank you"), so the capture is keyed to wheat.
 422    Subgoals: shop_menu_open -> (termination) wheat_purchased.
 423    """
 424
 425    TERMINATION_TRUNCATION_METRIC = SoH2WheatPurchasedTerminateMetric
 426    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ShopMenuOpenSubGoal])
 427
 428
 429class SwordOfHope2BuyCprSwordTestTracker(SwordOfHope2TestTracker):
 430    """
 431    Terminates when the agent buys the CPR Sword (3rd item) from the Weapons Shop.
 432    Starts at weapons_shop_example.state (player adjacent to the shopkeeper, ready to Look).
 433    Multi-step interaction:
 434      1. Look menu with cursor on shopkeeper
 435      2. After A on shopkeeper, BUY/SELL choice menu
 436      3. After picking BUY, item list visible (cursor on first item)
 437      4. Cursor navigated down to CPR Sword (3rd entry)
 438      5. After confirming, "CPR SWORD? Thank you"
 439    Subgoals: look_shopkeeper -> shop_buy_sell_menu -> weapons_shop_menu_open
 440              -> cursor_on_cpr_sword -> (termination) cpr_sword_purchased.
 441    """
 442
 443    TERMINATION_TRUNCATION_METRIC = SoH2CprSwordPurchasedTerminateMetric
 444    SUBGOAL_METRIC = make_subgoal_metric_class(
 445        [
 446            SoH2LookShopkeeperSubGoal,
 447            SoH2ShopBuySellMenuSubGoal,
 448            SoH2WeaponsShopMenuOpenSubGoal,
 449            SoH2CursorOnCprSwordSubGoal,
 450        ]
 451    )
 452
 453
 454class SwordOfHope2OverworldFromDefaultTestTracker(SwordOfHope2TestTracker):
 455    """
 456    Terminates when the agent reaches a stable overworld position with no open
 457    dialogue or menu (the Look/Open/Hit/Use/Magic/Power command grid is showing).
 458    Subgoals: dialogue_visible -> (termination) exploration_menu.
 459    """
 460
 461    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
 462    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2DialogueVisibleSubGoal])
 463
 464
 465class SwordOfHope2CursorOnPowerTestTracker(SwordOfHope2TestTracker):
 466    """Cursor at POWER in the exploration command grid. Region: status_command."""
 467    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnPowerTerminateMetric
 468    SUBGOAL_METRIC = DummySubGoalMetric
 469
 470
 471class SwordOfHope2PowerFirstPageTestTracker(SwordOfHope2TestTracker):
 472    """
 473    Terminates when the agent reaches the Power stats first page.
 474    Shorter scope than view_exp_needed_test (which cycles past the first page).
 475    Starts at default.state.
 476    Subgoals: cursor_on_power -> (termination) power_stats_first_page.
 477    """
 478
 479    TERMINATION_TRUNCATION_METRIC = SoH2PowerStatsFirstPageTerminateMetric
 480    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnPowerSubGoal])
 481
 482
 483class SwordOfHope2OpenMagicMenuTestTracker(SwordOfHope2TestTracker):
 484    """
 485    Terminates when the agent opens the Magic submenu from exploration.
 486    Starts at default.state.
 487    Subgoals: cursor_on_magic -> (termination) magic_menu_open.
 488    """
 489
 490    TERMINATION_TRUNCATION_METRIC = SoH2MagicMenuOpenTerminateMetric
 491    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnMagicSubGoal])
 492
 493
 494class SwordOfHope2OpenItemViewTestTracker(SwordOfHope2TestTracker):
 495    """
 496    Terminates when the agent opens the Item (inventory) submenu.
 497    Shorter scope than open_item_menu_test (which proceeds to the Use submenu).
 498    Starts at default.state.
 499    Subgoals: cursor_on_item -> (termination) item_menu_open.
 500    """
 501
 502    TERMINATION_TRUNCATION_METRIC = SoH2ItemMenuOpenTerminateMetric
 503    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnItemSubGoal])
 504
 505
 506class SwordOfHope2LookShopkeeperTestTracker(SwordOfHope2TestTracker):
 507    """
 508    Terminates when the agent looks at the weapons-shop shopkeeper (Look menu
 509    with cursor on shopkeeper visible).
 510    Starts at weapons_shop_example.state (player adjacent to the shopkeeper).
 511    Subgoals: cursor_on_look -> (termination) look_shopkeeper.
 512    """
 513
 514    TERMINATION_TRUNCATION_METRIC = SoH2LookShopkeeperTerminateMetric
 515    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnLookSubGoal])
 516
 517
 518class SwordOfHope2OpenWeaponsShopBuyTestTracker(SwordOfHope2TestTracker):
 519    """
 520    Terminates when the agent reaches the weapons shop's BUY item list.
 521    Shorter scope than buy_cpr_sword_test.
 522    Starts at weapons_shop_example.state.
 523    Subgoals: shop_buy_sell_menu -> (termination) weapons_shop_menu_open.
 524    """
 525
 526    TERMINATION_TRUNCATION_METRIC = SoH2WeaponsShopMenuOpenTerminateMetric
 527    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ShopBuySellMenuSubGoal])
 528
 529
 530class SwordOfHope2CursorOnCprSwordTestTracker(SwordOfHope2TestTracker):
 531    """
 532    Terminates when the cursor is on CPR Sword (3rd entry) in the weapons shop
 533    item list. Shorter scope than buy_cpr_sword_test (no purchase confirmation).
 534    Starts at weapons_shop_example.state.
 535    Subgoals: weapons_shop_menu_open -> (termination) cursor_on_cpr_sword.
 536    """
 537
 538    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnCprSwordTerminateMetric
 539    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2WeaponsShopMenuOpenSubGoal])
 540
 541
 542class SwordOfHope2OpenUseMenuTestTracker(SwordOfHope2TestTracker):
 543    """
 544    Terminates when the Use submenu opens after selecting a usable item.
 545    Shorter scope than use_wheat_test (which proceeds to wheat consumption).
 546    Starts at hit_tree_example.state (Wheat in inventory).
 547    Subgoals: item_menu_open -> cursor_on_wheat -> (termination) use_menu_open.
 548    """
 549
 550    TERMINATION_TRUNCATION_METRIC = SoH2UseMenuOpenTerminateMetric
 551    SUBGOAL_METRIC = make_subgoal_metric_class(
 552        [SoH2ItemMenuOpenSubGoal, SoH2CursorOnWheatSubGoal]
 553    )
 554
 555
 556class SwordOfHope2OpenShopBuySellTestTracker(SwordOfHope2TestTracker):
 557    """
 558    Terminates when the BUY/SELL choice menu opens after engaging the
 559    shopkeeper. Shorter scope than open_weapons_shop_buy_test (which proceeds
 560    to the BUY item list).
 561    Starts at weapons_shop_example.state.
 562    Subgoals: look_shopkeeper -> (termination) shop_buy_sell_menu.
 563    """
 564
 565    TERMINATION_TRUNCATION_METRIC = SoH2ShopBuySellMenuTerminateMetric
 566    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2LookShopkeeperSubGoal])
 567
 568
 569class SwordOfHope2CursorOnWheatTestTracker(SwordOfHope2TestTracker):
 570    """
 571    Terminates when the cursor lands on Wheat in the Item submenu.
 572    Shorter scope than use_wheat_test (which proceeds to consumption).
 573    Starts at hit_tree_example.state.
 574    Subgoals: item_menu_open -> (termination) cursor_on_wheat.
 575    """
 576
 577    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnWheatTerminateMetric
 578    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ItemMenuOpenSubGoal])
 579
 580
 581class SwordOfHope2BattleClashTestTracker(SwordOfHope2TestTracker):
 582    """
 583    Terminates when the cursor lands on CLASH in the battle command row.
 584    Mirror of cursor_on_auto_test but for the default attack command.
 585    Starts at battle_example.state.
 586    Subgoals: battle_active -> (termination) cursor_on_clash.
 587    """
 588
 589    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnClashTerminateMetric
 590    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])
 591
 592
 593class SwordOfHope2EnterTempleFirstFloorTestTracker(SwordOfHope2TestTracker):
 594    """
 595    Terminates when the agent reaches the Ancient Temple's 1st floor from
 596    outside the temple entrance. Story event #1 in SoH2 — leave Castle,
 597    find Ancient Temple. Starts at outside_temple.state.
 598    Subgoals: outside_temple -> (termination) temple_1f.
 599    """
 600
 601    TERMINATION_TRUNCATION_METRIC = SoH2Temple1fTerminateMetric
 602    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2OutsideTempleSubGoal])
 603
 604
 605class SwordOfHope1MillRoomTestTracker(SwordOfHope1TestTracker):
 606    """
 607    Terminates when the agent reaches the Mill Room (first adjacent room from start).
 608    """
 609
 610    TERMINATION_TRUNCATION_METRIC = MillRoomTerminateMetric
 611    SUBGOAL_METRIC = DummySubGoalMetric
 612
 613
 614class SwordOfHope1ShamanRoomTestTracker(SwordOfHope1TestTracker):
 615    """
 616    Terminates when the agent reaches the Shaman's Room.
 617    Subgoals: in_forest -> shaman_house -> (termination) shaman_room.
 618    """
 619
 620    TERMINATION_TRUNCATION_METRIC = ShamanRoomTerminateMetric
 621    SUBGOAL_METRIC = make_subgoal_metric_class([OldmanHouseSubGoal, InForestSubGoal, ShamanHouseSubGoal])
 622
 623
 624class SwordOfHope1DialogueClearTestTracker(SwordOfHope1TestTracker):
 625    """
 626    Terminates when the dialogue is cleared and control returns to the player.
 627    Subgoals: dialogue_active -> (termination) dialogue_cleared.
 628    """
 629
 630    TERMINATION_TRUNCATION_METRIC = DialogueClearedTerminateMetric
 631    SUBGOAL_METRIC = make_subgoal_metric_class([DialogueActiveSubGoal])
 632
 633
 634class SwordOfHope1BattleWonTestTracker(SwordOfHope1TestTracker):
 635    """
 636    Terminates when the battle is won.
 637    Subgoals: battle_active -> (termination) battle_won.
 638    """
 639
 640    TERMINATION_TRUNCATION_METRIC = BattleWonTerminateMetric
 641    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])
 642
 643
 644class SwordOfHope1LookItemTestTracker(SwordOfHope1TestTracker):
 645    """
 646    Terminates when a hidden item is found by looking at an object.
 647    Subgoals: look_selected -> look_target_options -> (termination) item_found.
 648    """
 649
 650    TERMINATION_TRUNCATION_METRIC = ItemFoundTerminateMetric
 651    SUBGOAL_METRIC = make_subgoal_metric_class([LookSelectedSubGoal, LookTargetOptionsSubGoal])
 652
 653
 654class SwordOfHope1BuyItemTestTracker(SwordOfHope1TestTracker):
 655    """
 656    Terminates when an item is purchased from a shop.
 657    Subgoals: shop_menu_open -> (termination) purchase_confirmed.
 658    """
 659
 660    TERMINATION_TRUNCATION_METRIC = PurchaseConfirmedTerminateMetric
 661    SUBGOAL_METRIC = make_subgoal_metric_class([ShopMenuOpenSubGoal])
 662
 663
 664class SwordOfHope1OverworldFromDefaultTestTracker(SwordOfHope1TestTracker):
 665    """
 666    Terminates when the agent reaches a stable overworld position with no open
 667    dialogue or menu (the Look/Open/Hit/Use/Magic/Power command grid is showing).
 668    Subgoals: dialogue_visible -> (termination) exploration_menu.
 669    """
 670
 671    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
 672    SUBGOAL_METRIC = make_subgoal_metric_class([DialogueVisibleSubGoal])
 673
 674
 675class SwordOfHope1TalkToNpcTestTracker(SwordOfHope1TestTracker):
 676    """
 677    Terminates when the agent talks to an NPC and advances one full dialogue page.
 678    Subgoals: dialogue_initiated -> (termination) dialogue_advanced.
 679    """
 680
 681    TERMINATION_TRUNCATION_METRIC = DialogueAdvancedTerminateMetric
 682    SUBGOAL_METRIC = make_subgoal_metric_class([DialogueInitiatedSubGoal])
 683
 684
 685class SwordOfHope1MenuOpenCloseTestTracker(SwordOfHope1TestTracker):
 686    """
 687    Terminates when the agent closes an open menu and returns to exploration.
 688    Starts at menu_example.state (menu already open at t=0).
 689    Subgoals: menu_open -> (termination) exploration_menu.
 690    """
 691
 692    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
 693    SUBGOAL_METRIC = make_subgoal_metric_class([MenuOpenSubGoal])
 694
 695
 696class SwordOfHope1BattleMagicCommandTestTracker(SwordOfHope1TestTracker):
 697    """
 698    Terminates when the agent selects a non-default battle command (Magic submenu open).
 699    Starts at battle_example.state (battle active at t=0, FIGHT menu default).
 700    Subgoals: battle_active -> (termination) battle_magic_menu.
 701    """
 702
 703    TERMINATION_TRUNCATION_METRIC = BattleMagicMenuTerminateMetric
 704    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])
 705
 706
 707class SwordOfHope1CastTeleportTestTracker(SwordOfHope1TestTracker):
 708    """
 709    Terminates when the agent opens Magic, selects Teleport and sees the result
 710    (destination list or 'cannot teleport' message).
 711    Starts at default.state (stable overworld, Lvl 1).
 712    Subgoals: magic_menu_open -> (termination) teleport_result.
 713    """
 714
 715    TERMINATION_TRUNCATION_METRIC = TeleportResultTerminateMetric
 716    SUBGOAL_METRIC = make_subgoal_metric_class([MagicMenuOpenSubGoal])
 717
 718
 719class SwordOfHope1TalkToNpcMultipleTestTracker(SwordOfHope1TestTracker):
 720    """
 721    Terminates when the agent talks to the same NPC twice and sees a distinct
 722    second-visit dialogue (progression event, e.g. Mistress giving Scroll of Grace).
 723    Starts at shop_forest.state (near the Mistress at the Forest Shop).
 724    Subgoals: mistress_first_dialogue -> (termination) mistress_second_dialogue.
 725    """
 726
 727    TERMINATION_TRUNCATION_METRIC = MistressSecondDialogueTerminateMetric
 728    SUBGOAL_METRIC = make_subgoal_metric_class([MistressFirstDialogueSubGoal])
 729
 730
 731class SwordOfHope1BinaryChoiceSaveTestTracker(SwordOfHope1TestTracker):
 732    """
 733    Terminates when the agent answers Yes to the Shaman's save prompt.
 734    Starts at at_shaman.state (player in front of Shaman, ready to talk).
 735    Subgoals: save_prompt_visible -> (termination) save_confirmed.
 736    """
 737
 738    TERMINATION_TRUNCATION_METRIC = SaveConfirmedTerminateMetric
 739    SUBGOAL_METRIC = make_subgoal_metric_class([SavePromptVisibleSubGoal])
 740
 741
 742class SwordOfHope1LookSurroundHerbTestTracker(SwordOfHope1TestTracker):
 743    """
 744    Terminates when the agent Looks at the Path target at Old Man's Forest [C5]
 745    and receives a Herb.
 746    Starts at forest_c5.state (player at [C5] in Old Man's Forest).
 747    Subgoals: look_path_target -> (termination) herb_received.
 748    """
 749
 750    TERMINATION_TRUNCATION_METRIC = HerbReceivedTerminateMetric
 751    SUBGOAL_METRIC = make_subgoal_metric_class([LookPathTargetSubGoal])
 752
 753
 754class SwordOfHope1DefeatTreantTestTracker(SwordOfHope1TestTracker):
 755    """
 756    Terminates when the agent defeats Treant in battle (walkthrough event #2),
 757    receiving Key M. Uses offensive magic (Firebal2 strategy, lvl 4+).
 758    Starts at treant_battle_start.state (Treant battle active, FIGHT menu default).
 759    Subgoals: battle_active -> (termination) treant_defeated.
 760    """
 761
 762    TERMINATION_TRUNCATION_METRIC = TreantDefeatedTerminateMetric
 763    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])
 764
 765
 766class SwordOfHope1UseKeyUnlockTestTracker(SwordOfHope1TestTracker):
 767    """
 768    Terminates when the agent uses Key M at the Martel's Domain gate ([A4] in
 769    Old Man's Forest) and unlocks the passage to Martel's Domain.
 770    Starts at at_martel_gate.state (player at [A4] with Key M in inventory, gate still locked).
 771    Subgoals: key_m_selected -> (termination) gate_opened.
 772    """
 773
 774    TERMINATION_TRUNCATION_METRIC = GateOpenedTerminateMetric
 775    SUBGOAL_METRIC = make_subgoal_metric_class([KeyMSelectedSubGoal])
 776
 777
 778class SwordOfHope1CollectScrollGraceTestTracker(SwordOfHope1TestTracker):
 779    """
 780    Terminates when the agent picks up the Scroll of Grace from the Forest Shop
 781    backroom (Old Man's Forest [E2]) after talking to the Mistress twice.
 782    Starts at mistress_backroom_access.state (player inside the backroom).
 783    Subgoals: in_backroom -> (termination) scroll_received.
 784    """
 785
 786    TERMINATION_TRUNCATION_METRIC = ScrollReceivedTerminateMetric
 787    SUBGOAL_METRIC = make_subgoal_metric_class([InBackroomSubGoal])
 788
 789
 790class SwordOfHope1CastGraceAltarTestTracker(SwordOfHope1TestTracker):
 791    """
 792    Terminates when the agent casts the Grace spell at the Martel's Domain [F3]
 793    altar and receives the Charm (walkthrough event #4).
 794    Starts at at_martel_altar.state (player at [F3] with Scroll of Grace in inventory).
 795    Subgoals: grace_selected -> (termination) charm_received.
 796    """
 797
 798    TERMINATION_TRUNCATION_METRIC = CharmReceivedTerminateMetric
 799    SUBGOAL_METRIC = make_subgoal_metric_class([GraceSelectedSubGoal])
 800
 801
 802class SwordOfHope1CompleteTeleportTestTracker(SwordOfHope1TestTracker):
 803    """
 804    Terminates when the agent completes a Teleport cast and lands at a destination.
 805    Starts from an overworld state (e.g. default).
 806    Subgoals: teleport_dest_cursor (destination list visible with cursor on a dest)
 807    -> (termination) teleport_landed (post-teleport command_area state).
 808    """
 809
 810    TERMINATION_TRUNCATION_METRIC = TeleportLandedTerminateMetric
 811    SUBGOAL_METRIC = make_subgoal_metric_class([TeleportDestCursorSubGoal])
 812
 813
 814class SwordOfHope1EscapeBattleTestTracker(SwordOfHope1TestTracker):
 815    """
 816    Terminates when the agent successfully Escapes from a battle.
 817    Starts at battle_example.state (battle active at t=0).
 818    Subgoals: battle_active -> (termination) escape_confirmed
 819    (e.g. "You escaped!" or post-escape battle_command state).
 820    """
 821
 822    TERMINATION_TRUNCATION_METRIC = EscapeConfirmedTerminateMetric
 823    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])
 824
 825
 826class SwordOfHope1CursorOnLookTestTracker(SwordOfHope1TestTracker):
 827    """Cursor at LOOK in the exploration command grid. Region: status_command."""
 828    TERMINATION_TRUNCATION_METRIC = CursorOnLookTerminateMetric
 829    SUBGOAL_METRIC = DummySubGoalMetric
 830
 831
 832class SwordOfHope1CursorOnOpenTestTracker(SwordOfHope1TestTracker):
 833    """Cursor at OPEN in the exploration command grid."""
 834    TERMINATION_TRUNCATION_METRIC = CursorOnOpenTerminateMetric
 835    SUBGOAL_METRIC = DummySubGoalMetric
 836
 837
 838class SwordOfHope1CursorOnUseTestTracker(SwordOfHope1TestTracker):
 839    """Cursor at USE in the exploration command grid."""
 840    TERMINATION_TRUNCATION_METRIC = CursorOnUseTerminateMetric
 841    SUBGOAL_METRIC = DummySubGoalMetric
 842
 843
 844class SwordOfHope1CursorOnMagicTestTracker(SwordOfHope1TestTracker):
 845    """Cursor at MAGIC in the exploration command grid."""
 846    TERMINATION_TRUNCATION_METRIC = CursorOnMagicTerminateMetric
 847    SUBGOAL_METRIC = DummySubGoalMetric
 848
 849
 850class SwordOfHope1CursorOnHitTestTracker(SwordOfHope1TestTracker):
 851    """Cursor at HIT in the exploration command grid."""
 852    TERMINATION_TRUNCATION_METRIC = CursorOnHitTerminateMetric
 853    SUBGOAL_METRIC = DummySubGoalMetric
 854
 855
 856class SwordOfHope1CursorOnPowerTestTracker(SwordOfHope1TestTracker):
 857    """Cursor at POWER in the exploration command grid."""
 858    TERMINATION_TRUNCATION_METRIC = CursorOnPowerTerminateMetric
 859    SUBGOAL_METRIC = DummySubGoalMetric
 860
 861
 862class SwordOfHope1CycleThroughCommandsTestTracker(SwordOfHope1TestTracker):
 863    """
 864    Terminates when the agent has cycled the cursor through all 6 commands
 865    in order (LOOK -> OPEN -> USE -> MAGIC -> HIT -> POWER) without pressing
 866    A on any of them.
 867    Starts at default.state.
 868    Subgoals: cursor_on_look -> cursor_on_open -> cursor_on_use
 869              -> cursor_on_magic -> cursor_on_hit
 870              -> (termination) cursor_on_power.
 871    """
 872
 873    TERMINATION_TRUNCATION_METRIC = CursorOnPowerTerminateMetric
 874    SUBGOAL_METRIC = make_subgoal_metric_class(
 875        [
 876            CursorOnLookSubGoal,
 877            CursorOnOpenSubGoal,
 878            CursorOnUseSubGoal,
 879            CursorOnMagicSubGoal,
 880            CursorOnHitSubGoal,
 881        ]
 882    )
 883
 884
 885class SwordOfHope1OpenStatusViewTestTracker(SwordOfHope1TestTracker):
 886    """
 887    Terminates when the agent reaches the Power menu's first stats page.
 888    Full chain: navigate cursor to Power in command grid -> press A to open
 889    Power -> first stats page visible.
 890    Starts at default.state.
 891    Subgoals: cursor_on_power -> (termination) power_stats_first_page.
 892    """
 893
 894    TERMINATION_TRUNCATION_METRIC = PowerStatsFirstPageTerminateMetric
 895    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnPowerSubGoal])
 896
 897
 898class SwordOfHope1AutoBattleTestTracker(SwordOfHope1TestTracker):
 899    """
 900    Terminates when the agent navigates the cursor onto the AUTO command in
 901    the battle command row. Tests command-row navigation in battle.
 902    Starts at battle_example.state.
 903    Subgoals: battle_active -> (termination) cursor_on_auto.
 904    """
 905
 906    TERMINATION_TRUNCATION_METRIC = CursorOnAutoTerminateMetric
 907    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])
 908
 909
 910class SwordOfHope1ShopMenuOpenTestTracker(SwordOfHope1TestTracker):
 911    """
 912    Terminates when the shop's buy menu first opens. Shorter scope than
 913    buy_item_test (which proceeds to purchase confirmation).
 914    Starts at shop_forest.state.
 915    Subgoals: dummy (single-step interaction).
 916    """
 917
 918    TERMINATION_TRUNCATION_METRIC = ShopMenuOpenTerminateMetric
 919    SUBGOAL_METRIC = DummySubGoalMetric
 920
 921
 922class SwordOfHope1LookCommandSelectTestTracker(SwordOfHope1TestTracker):
 923    """
 924    Terminates when the LOOK command is selected in the command grid.
 925    Shorter scope than look_item_test (which proceeds to item discovery).
 926    Starts at default.state.
 927    Subgoals: dummy (single-step cursor + A).
 928    """
 929
 930    TERMINATION_TRUNCATION_METRIC = LookSelectedTerminateMetric
 931    SUBGOAL_METRIC = DummySubGoalMetric
 932
 933
 934class SwordOfHope1MenuOpenTestTracker(SwordOfHope1TestTracker):
 935    """
 936    Terminates when the command menu first opens. Shorter scope than
 937    menu_open_close_test (which proceeds to closing back to exploration).
 938    Starts at default.state.
 939    Subgoals: dummy (single-step menu trigger).
 940    """
 941
 942    TERMINATION_TRUNCATION_METRIC = MenuOpenTerminateMetric
 943    SUBGOAL_METRIC = DummySubGoalMetric
 944
 945
 946class SwordOfHope1MagicMenuOpenTestTracker(SwordOfHope1TestTracker):
 947    """
 948    Terminates when the Magic spell list opens from the overworld. Shorter
 949    scope than cast_teleport_test (which proceeds to casting Teleport).
 950    Starts at default.state.
 951    Subgoals: dummy (single navigation chain to open Magic submenu).
 952    """
 953
 954    TERMINATION_TRUNCATION_METRIC = MagicMenuOpenTerminateMetric
 955    SUBGOAL_METRIC = DummySubGoalMetric
 956
 957
 958class SwordOfHope1DialogueInitiatedTestTracker(SwordOfHope1TestTracker):
 959    """
 960    Terminates the moment an NPC dialogue page first appears. Shorter scope
 961    than talk_to_npc_test (which proceeds through one full dialogue advance).
 962    Starts at default.state.
 963    Subgoals: dummy (single talk action).
 964    """
 965
 966    TERMINATION_TRUNCATION_METRIC = DialogueInitiatedTerminateMetric
 967    SUBGOAL_METRIC = DummySubGoalMetric
 968
 969
 970# ---------------------------------------------------------------------------
 971# SoH1 — 50-task push: reasoning-hard trackers
 972# Zero-capture set: each task reuses existing termination .npy but enforces a
 973# non-trivial subgoal sequence the agent must satisfy (open-then-cancel,
 974# constrained cycle paths, in-battle menu-cancel reasoning).
 975# Capture-pending set: each task terminates on a "cursor on a specific list
 976# entry" target the user will capture in dev_play.
 977# ---------------------------------------------------------------------------
 978
 979
 980class SwordOfHope1CancelMagicMenuTestTracker(SwordOfHope1TestTracker):
 981    """
 982    Open the Magic submenu from exploration, then back out without casting.
 983    Tests menu-cancel reasoning: agent must understand the B-button semantics
 984    and recognize the difference between "open menu" and "commit to action".
 985    Init: default.state. Subgoal: magic_menu_open -> (term) exploration_menu.
 986    """
 987
 988    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
 989    SUBGOAL_METRIC = make_subgoal_metric_class([MagicMenuOpenSubGoal])
 990
 991
 992class SwordOfHope1CancelPowerMenuTestTracker(SwordOfHope1TestTracker):
 993    """
 994    Open the Power stats menu, view first stats page, then close back to
 995    exploration. Multi-step menu navigation with a deliberate exit.
 996    Init: default.state. Subgoal: power_stats_first_page -> (term) exploration_menu.
 997    """
 998
 999    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
1000    SUBGOAL_METRIC = make_subgoal_metric_class([PowerStatsFirstPageSubGoal])
1001
1002
1003class SwordOfHope1CancelTeleportMenuTestTracker(SwordOfHope1TestTracker):
1004    """
1005    Open Magic -> Teleport -> destination list, then cancel back to
1006    exploration without teleporting. Tests cancellation of nested menus.
1007    Init: default.state. Subgoal: teleport_dest_cursor -> (term) exploration_menu.
1008    """
1009
1010    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
1011    SUBGOAL_METRIC = make_subgoal_metric_class([TeleportDestCursorSubGoal])
1012
1013
1014class SwordOfHope1CancelShopMenuTestTracker(SwordOfHope1TestTracker):
1015    """
1016    Open the shop's buy menu, then exit without purchasing. Distinguishes
1017    "browse the inventory" from "commit to a purchase".
1018    Init: shop_forest.state. Subgoal: shop_menu_open -> (term) exploration_menu.
1019    """
1020
1021    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
1022    SUBGOAL_METRIC = make_subgoal_metric_class([ShopMenuOpenSubGoal])
1023
1024
1025class SwordOfHope1CancelLookOptionsTestTracker(SwordOfHope1TestTracker):
1026    """
1027    Select LOOK and view the target options, then back out without choosing.
1028    Pure inspection task: information-gather without committing.
1029    Init: default.state. Subgoal: look_target_options -> (term) exploration_menu.
1030    """
1031
1032    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
1033    SUBGOAL_METRIC = make_subgoal_metric_class([LookTargetOptionsSubGoal])
1034
1035
1036class SwordOfHope1BattleMagicCancelTestTracker(SwordOfHope1TestTracker):
1037    """
1038    In battle, open the Magic submenu, then back out without casting. Battle
1039    contexts have a different default cursor; agent must learn the in-battle
1040    cancel pattern is symmetric to the overworld one.
1041    Init: battle_example.state. Subgoal: battle_magic_menu -> (term) battle_active.
1042    """
1043
1044    TERMINATION_TRUNCATION_METRIC = BattleActiveTerminateMetric
1045    SUBGOAL_METRIC = make_subgoal_metric_class([BattleMagicMenuSubGoal])
1046
1047
1048class SwordOfHope1CycleBackToLookTestTracker(SwordOfHope1TestTracker):
1049    """
1050    Starting from cursor on LOOK, the agent must cycle the cursor through the
1051    command grid all the way around (LOOK -> ... -> POWER -> wrap -> LOOK).
1052    Termination matches the original LOOK position but the SUBGOAL forces the
1053    agent to have actually visited POWER en route - otherwise it would just
1054    stay in place. Tests cyclic navigation understanding.
1055    Init: default.state. Subgoal: cursor_on_power -> (term) cursor_on_look.
1056    """
1057
1058    TERMINATION_TRUNCATION_METRIC = CursorOnLookTerminateMetric
1059    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnPowerSubGoal])
1060
1061
1062class SwordOfHope1CycleToPowerViaMagicTestTracker(SwordOfHope1TestTracker):
1063    """
1064    Navigate cursor to POWER, but only via MAGIC (constrained path). Forces the
1065    agent to take the lower-row route rather than the shortest L->R top-row
1066    route. Tests constrained-path reasoning.
1067    Init: default.state. Subgoal: cursor_on_magic -> (term) cursor_on_power.
1068    """
1069
1070    TERMINATION_TRUNCATION_METRIC = CursorOnPowerTerminateMetric
1071    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnMagicSubGoal])
1072
1073
1074class SwordOfHope1CursorOnFirebalTestTracker(SwordOfHope1TestTracker):
1075    """
1076    In battle, open the Magic submenu and navigate the cursor to the FIREBAL
1077    spell specifically (not Firebal2, not other spells). Firebal is a
1078    battle-only spell in SoH1. Tests spell selection under list ambiguity.
1079    Init: pre_treant_engage.state (lvl 4 Theo with Firebal learned, in battle).
1080    Subgoal: battle_magic_menu -> (term) cursor_on_firebal.
1081    """
1082
1083    TERMINATION_TRUNCATION_METRIC = CursorOnFirebalTerminateMetric
1084    SUBGOAL_METRIC = make_subgoal_metric_class([BattleMagicMenuSubGoal])
1085
1086
1087class SwordOfHope1CursorOnFirebal2TestTracker(SwordOfHope1TestTracker):
1088    """
1089    In battle, open the Magic submenu and cursor on FIREBAL2 specifically
1090    (the upgraded variant). Battle-only spell. Tests fine-grained spell
1091    distinction in the battle Magic list.
1092    Init: pre_treant_engage.state (verify Firebal2 is in spell list at lvl 4).
1093    Subgoal: battle_magic_menu -> (term) cursor_on_firebal2.
1094    """
1095
1096    TERMINATION_TRUNCATION_METRIC = CursorOnFirebal2TerminateMetric
1097    SUBGOAL_METRIC = make_subgoal_metric_class([BattleMagicMenuSubGoal])
1098
1099
1100class SwordOfHope1CursorOnStripallTestTracker(SwordOfHope1TestTracker):
1101    """
1102    In battle, open the Magic submenu and cursor on STRIPALL specifically.
1103    Stripall is a battle-only debuff spell that strips enemy buffs/defense.
1104    Tests spell-purpose disambiguation: agent must distinguish damage spells
1105    (Firebal/Firebal2) from utility spells (Stripall) in the same list.
1106    Init: pre_treant_engage.state.
1107    Subgoal: battle_magic_menu -> (term) cursor_on_stripall.
1108    """
1109
1110    TERMINATION_TRUNCATION_METRIC = CursorOnStripallTerminateMetric
1111    SUBGOAL_METRIC = make_subgoal_metric_class([BattleMagicMenuSubGoal])
1112
1113
1114class SwordOfHope1CursorOnTeleportOldmanTestTracker(SwordOfHope1TestTracker):
1115    """
1116    Cast Teleport and navigate the destination cursor onto OLD MAN'S HOUSE
1117    specifically (not Shaman's, not Forest). Tests destination disambiguation.
1118    Init: near_treant_postkill.state (multiple teleport destinations available).
1119    Subgoal: teleport_dest_cursor -> (term) cursor_on_teleport_oldman.
1120    """
1121
1122    TERMINATION_TRUNCATION_METRIC = CursorOnTeleportOldmanTerminateMetric
1123    SUBGOAL_METRIC = make_subgoal_metric_class([TeleportDestCursorSubGoal])
1124
1125
1126class SwordOfHope1CursorOnHerbUseTestTracker(SwordOfHope1TestTracker):
1127    """
1128    Open the Use submenu and navigate cursor to HERB specifically (not Key M,
1129    not Scroll, not other items). Tests inventory item disambiguation.
1130    Init: mistress_backroom_access_collected.state (has Scroll + Herb).
1131    Subgoal: cursor_on_use -> (term) cursor_on_herb_use.
1132    """
1133
1134    TERMINATION_TRUNCATION_METRIC = CursorOnHerbUseTerminateMetric
1135    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnUseSubGoal])
1136
1137
1138class SwordOfHope1CursorOnKeymUseTestTracker(SwordOfHope1TestTracker):
1139    """
1140    Open the Use submenu and navigate cursor to KEY M specifically. Tests
1141    inventory disambiguation in the at_martel_gate context where Key M is
1142    the correct (quest-required) item among other inventory entries.
1143    Init: at_martel_gate.state. Subgoal: cursor_on_use -> (term) cursor_on_keym_use.
1144    """
1145
1146    TERMINATION_TRUNCATION_METRIC = CursorOnKeymUseTerminateMetric
1147    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnUseSubGoal])
1148
1149
1150class SwordOfHope1BattleStripallCancelTestTracker(SwordOfHope1TestTracker):
1151    """
1152    In battle, navigate to STRIPALL in the Magic submenu (cursor on Stripall),
1153    then back out without casting it. Tests inspect-without-commit reasoning
1154    in a battle context with a non-default spell choice.
1155    Init: pre_treant_engage.state (battle active, Theo at lvl 4+).
1156    Subgoals (2):
1157        battle_magic_menu -> cursor_on_stripall -> (term) battle_active.
1158    """
1159
1160    TERMINATION_TRUNCATION_METRIC = BattleActiveTerminateMetric
1161    SUBGOAL_METRIC = make_subgoal_metric_class(
1162        [BattleMagicMenuSubGoal, CursorOnStripallSubGoal]
1163    )
1164
1165
1166class SwordOfHope1ViewPowerThenTeleportOldmanTestTracker(SwordOfHope1TestTracker):
1167    """
1168    Long-horizon composite reasoning task: agent must inspect player stats
1169    THEN travel via Teleport. Full chain:
1170      1. Navigate command cursor to POWER, press A to open Power stats
1171      2. Scroll through the Power stat slides to the LAST page
1172      3. Press B to close back to exploration
1173      4. Open Magic submenu -> select TELEPORT
1174      5. In destination list, navigate cursor to OLD MAN'S HOUSE
1175      6. Press A to confirm; agent lands at Old Man's House
1176    Termination: room_label shows oldman_house.
1177    Init: lvl5_overworld.state (player at lvl 5+, Teleport unlocked, Old Man's
1178    House available as a teleport destination).
1179    Subgoals (3, in order):
1180        cursor_on_power -> power_stats_last_page -> cursor_on_teleport_oldman
1181        -> (term) oldman_house.
1182    Tests: long-horizon planning with menu-inspect-then-act reasoning across
1183    three distinct UI contexts (command grid, Power stats menu, Teleport
1184    destination list) before the agent commits to the travel action.
1185    """
1186
1187    TERMINATION_TRUNCATION_METRIC = OldmanHouseTerminateMetric
1188    SUBGOAL_METRIC = make_subgoal_metric_class(
1189        [
1190            CursorOnPowerSubGoal,
1191            PowerStatsLastPageSubGoal,
1192            CursorOnTeleportOldmanSubGoal,
1193        ]
1194    )
1195
1196
1197# ---------------------------------------------------------------------------
1198# SoH2 — 50-task push: reasoning-hard trackers
1199# ---------------------------------------------------------------------------
1200
1201
1202class SwordOfHope2CancelMagicMenuTestTracker(SwordOfHope2TestTracker):
1203    """
1204    Open the Magic submenu from exploration, then back out without casting.
1205    Mirror of SoH1 variant. Tests menu-cancel reasoning.
1206    Init: lvl2_overworld.state (Theo has Motion spell available).
1207    Subgoal: magic_menu_open -> (term) exploration_menu.
1208    """
1209
1210    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1211    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2MagicMenuOpenSubGoal])
1212
1213
1214class SwordOfHope2CancelItemMenuTestTracker(SwordOfHope2TestTracker):
1215    """
1216    Open the Item submenu (inventory list), then back out without using
1217    anything. Tests inventory-browse vs commit-to-use distinction.
1218    Init: hit_tree_example.state (Wheat in inventory).
1219    Subgoal: item_menu_open -> (term) exploration_menu.
1220    """
1221
1222    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1223    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ItemMenuOpenSubGoal])
1224
1225
1226class SwordOfHope2CancelShopMenuTestTracker(SwordOfHope2TestTracker):
1227    """
1228    Open a shop's buy menu, then exit without purchasing.
1229    Init: shop_example.state. Subgoal: shop_menu_open -> (term) exploration_menu.
1230    """
1231
1232    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1233    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ShopMenuOpenSubGoal])
1234
1235
1236class SwordOfHope2CancelWeaponsShopBuyTestTracker(SwordOfHope2TestTracker):
1237    """
1238    Navigate into the weapons shop BUY item list, then exit without buying.
1239    Init: weapons_shop_example.state.
1240    Subgoal: weapons_shop_menu_open -> (term) exploration_menu.
1241    """
1242
1243    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1244    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2WeaponsShopMenuOpenSubGoal])
1245
1246
1247class SwordOfHope2CancelLookShopkeeperTestTracker(SwordOfHope2TestTracker):
1248    """
1249    Look at the weapons-shop shopkeeper, then back out without engaging.
1250    Tests Look-without-interact distinction.
1251    Init: weapons_shop_example.state.
1252    Subgoal: look_shopkeeper -> (term) exploration_menu.
1253    """
1254
1255    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1256    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2LookShopkeeperSubGoal])
1257
1258
1259class SwordOfHope2AutoToClashBattleTestTracker(SwordOfHope2TestTracker):
1260    """
1261    Starting in battle, navigate cursor to AUTO first, then move it back to
1262    CLASH (reverse selection). Tests reversible cursor reasoning in battle.
1263    Init: battle_example.state.
1264    Subgoal: cursor_on_auto -> (term) cursor_on_clash.
1265    """
1266
1267    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnClashTerminateMetric
1268    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnAutoSubGoal])
1269
1270
1271class SwordOfHope2ClashToAutoBattleTestTracker(SwordOfHope2TestTracker):
1272    """
1273    Starting in battle, cursor on CLASH (default), navigate to AUTO.
1274    Mirror of the AUTO->CLASH variant. Tests reverse-direction cursor.
1275    Init: battle_example.state.
1276    Subgoal: cursor_on_clash -> (term) cursor_on_auto.
1277    """
1278
1279    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnAutoTerminateMetric
1280    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnClashSubGoal])
1281
1282
1283class SwordOfHope2CursorOnMotionTestTracker(SwordOfHope2TestTracker):
1284    """
1285    Open the Magic submenu and navigate the cursor to MOTION (the lvl-2
1286    overworld spell). SoH2's party system requires an extra step compared to
1287    SoH1: agent must first pick the party member (Theo) before their spell
1288    list is shown.
1289    Init: lvl2_overworld.state.
1290    Subgoals (2, in order):
1291        magic_menu_open (party member list visible)
1292        -> cursor_on_theo (cursor on Theo in party list, about to confirm)
1293        -> (term) cursor_on_motion (cursor on Motion in Theo's spell list).
1294    """
1295
1296    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnMotionTerminateMetric
1297    SUBGOAL_METRIC = make_subgoal_metric_class(
1298        [SoH2MagicMenuOpenSubGoal, SoH2CursorOnTheoSubGoal]
1299    )
1300
1301
1302class SwordOfHope2CursorOnShopFirstItemTestTracker(SwordOfHope2TestTracker):
1303    """
1304    In a generic shop's buy list, cursor on the FIRST item entry. Tests "go
1305    to top of list" reasoning - distinguished from "cursor on Wheat" which is
1306    a different shop layout.
1307    Init: shop_example.state.
1308    Subgoal: shop_menu_open -> (term) cursor_on_shop_first_item.
1309    """
1310
1311    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnShopFirstItemTerminateMetric
1312    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ShopMenuOpenSubGoal])
1313
1314
1315class SwordOfHope2CursorOnShopThirdItemTestTracker(SwordOfHope2TestTracker):
1316    """
1317    Same shop as cursor_on_shop_first_item_test, but cursor on the THIRD item
1318    entry. Tests bounded list navigation — agent must traverse from the
1319    default cursor position (first item) down to the third.
1320    Init: shop_example.state.
1321    Subgoals (2): shop_menu_open -> cursor_on_shop_first_item ->
1322        (term) cursor_on_shop_third_item.
1323    """
1324
1325    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnShopThirdItemTerminateMetric
1326    SUBGOAL_METRIC = make_subgoal_metric_class(
1327        [SoH2ShopMenuOpenSubGoal, SoH2CursorOnShopFirstItemSubGoal]
1328    )
1329
1330
1331class SwordOfHope2CursorOnFirstWeaponTestTracker(SwordOfHope2TestTracker):
1332    """
1333    In the weapons shop, cursor on the FIRST weapon entry. Distinguished from
1334    cursor_on_cpr_sword_test (3rd entry) - tests "top of list" navigation.
1335    Init: weapons_shop_example.state.
1336    Subgoal: weapons_shop_menu_open -> (term) cursor_on_first_weapon.
1337    """
1338
1339    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnFirstWeaponTerminateMetric
1340    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2WeaponsShopMenuOpenSubGoal])
1341
1342
1343class SwordOfHope2CursorOnSecondWeaponTestTracker(SwordOfHope2TestTracker):
1344    """
1345    Weapons shop, cursor on the SECOND weapon entry. Tests single-step
1346    navigation from the first item position.
1347    Init: weapons_shop_example.state.
1348    Subgoals (2): weapons_shop_menu_open -> cursor_on_first_weapon ->
1349        (term) cursor_on_second_weapon.
1350    """
1351
1352    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnSecondWeaponTerminateMetric
1353    SUBGOAL_METRIC = make_subgoal_metric_class(
1354        [SoH2WeaponsShopMenuOpenSubGoal, SoH2CursorOnFirstWeaponSubGoal]
1355    )
1356
1357
1358class SwordOfHope2CursorOnThirdWeaponTestTracker(SwordOfHope2TestTracker):
1359    """
1360    Weapons shop, cursor on the THIRD weapon entry (CPR Sword in current
1361    shop layout). Distinguished from cursor_on_cpr_sword_test by framing:
1362    this tests bounded-list navigation by position, not by name.
1363    Init: weapons_shop_example.state.
1364    Subgoals (3): weapons_shop_menu_open -> cursor_on_first_weapon ->
1365        cursor_on_second_weapon -> (term) cursor_on_third_weapon.
1366    """
1367
1368    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnThirdWeaponTerminateMetric
1369    SUBGOAL_METRIC = make_subgoal_metric_class(
1370        [
1371            SoH2WeaponsShopMenuOpenSubGoal,
1372            SoH2CursorOnFirstWeaponSubGoal,
1373            SoH2CursorOnSecondWeaponSubGoal,
1374        ]
1375    )
1376
1377
1378class SwordOfHope2LookTreeTargetTestTracker(SwordOfHope2TestTracker):
1379    """
1380    Use LOOK on a grass tile (not the shopkeeper, not the tree). Tests
1381    target disambiguation in the Look menu where multiple visible targets
1382    are available.
1383    Init: hit_tree_example.state (grass tiles nearby).
1384    Subgoal: cursor_on_look -> (term) look_tree_target.
1385    """
1386
1387    TERMINATION_TRUNCATION_METRIC = SoH2LookTreeTargetTerminateMetric
1388    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnLookSubGoal])
1389
1390
1391class SwordOfHope2ViewPowerThenCastMotionTestTracker(SwordOfHope2TestTracker):
1392    """
1393    Long-horizon composite reasoning task (SoH2 mirror of SoH1's
1394    view_power_then_teleport_oldman_test):
1395      1. Navigate command cursor to POWER, press A
1396      2. Scroll through Power stats first page to the exp/level page
1397      3. Press B to close Power back to exploration
1398      4. Open Magic submenu, choose Theo, choose Motion, confirm cast
1399    Termination: motion_result (Motion cast confirmation dialogue).
1400    Init: lvl2_overworld.state.
1401    Subgoals (3, in order):
1402        cursor_on_power -> power_stats_first_page -> power_stats_exp_page
1403        -> (term) motion_result.
1404    Tests: inspect-then-act long-horizon planning across Power menu and
1405    party-magic chain.
1406    """
1407
1408    TERMINATION_TRUNCATION_METRIC = SoH2MotionResultTerminateMetric
1409    SUBGOAL_METRIC = make_subgoal_metric_class(
1410        [
1411            SoH2CursorOnPowerSubGoal,
1412            SoH2PowerStatsFirstPageSubGoal,
1413            SoH2PowerStatsExpPageSubGoal,
1414        ]
1415    )
class SwordOfHopeOCRTracker(gameboy_worlds.emulation.tracker.StateTracker):
162class SwordOfHopeOCRTracker(StateTracker):
163    """
164    Base StateTracker that always captures the full Game Boy screen as an OCR region.
165    Used as the default tracker for both Sword of Hope 1 and Sword of Hope 2 so that
166    OCR-eligible captures are always available for downstream agents.
167    """
168
169    def start(self):
170        super().start()
171        self.metric_classes.append(SwordOfHopeOCRMetric)

Base StateTracker that always captures the full Game Boy screen as an OCR region. Used as the default tracker for both Sword of Hope 1 and Sword of Hope 2 so that OCR-eligible captures are always available for downstream agents.

def start(self):
169    def start(self):
170        super().start()
171        self.metric_classes.append(SwordOfHopeOCRMetric)

Sets up the metrics for the tracker by creating the list self.metric_classes

Child classes must FIRST call super().start() and THEN set up their own metric classes.

class SwordOfHope1TestTracker(gameboy_worlds.emulation.tracker.TestTrackerMixin, SwordOfHopeOCRTracker):
174class SwordOfHope1TestTracker(TestTrackerMixin, SwordOfHopeOCRTracker):
175    """
176    Base TestTracker for Sword of Hope 1.
177    Inherit this class and set TERMINATION_TRUNCATION_METRIC to create task-specific trackers.
178    """
179
180    TERMINATION_TRUNCATION_METRIC = MillRoomTerminateMetric
181    SUBGOAL_METRIC = DummySubGoalMetric

Base TestTracker for Sword of Hope 1. Inherit this class and set TERMINATION_TRUNCATION_METRIC to create task-specific trackers.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2TestTracker(gameboy_worlds.emulation.tracker.TestTrackerMixin, SwordOfHopeOCRTracker):
184class SwordOfHope2TestTracker(TestTrackerMixin, SwordOfHopeOCRTracker):
185    """
186    Base TestTracker for Sword of Hope 2.
187    Inherit this class and set TERMINATION_TRUNCATION_METRIC to create task-specific trackers.
188    """
189
190    TERMINATION_TRUNCATION_METRIC = None
191    SUBGOAL_METRIC = DummySubGoalMetric

Base TestTracker for Sword of Hope 2. Inherit this class and set TERMINATION_TRUNCATION_METRIC to create task-specific trackers.

TERMINATION_TRUNCATION_METRIC = None

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2DialogueClearTestTracker(SwordOfHope2TestTracker):
194class SwordOfHope2DialogueClearTestTracker(SwordOfHope2TestTracker):
195    """
196    Terminates when the dialogue is cleared and control returns to the player.
197    Subgoals: dialogue_active -> (termination) dialogue_cleared.
198    """
199
200    TERMINATION_TRUNCATION_METRIC = SoH2DialogueClearedTerminateMetric
201    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2DialogueActiveSubGoal])

Terminates when the dialogue is cleared and control returns to the player. Subgoals: dialogue_active -> (termination) dialogue_cleared.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2TalkToNpcTestTracker(SwordOfHope2TestTracker):
204class SwordOfHope2TalkToNpcTestTracker(SwordOfHope2TestTracker):
205    """
206    Terminates when the agent talks to an NPC and advances one full dialogue page.
207    Subgoals: dialogue_initiated -> (termination) dialogue_advanced.
208    """
209
210    TERMINATION_TRUNCATION_METRIC = SoH2DialogueAdvancedTerminateMetric
211    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2DialogueInitiatedSubGoal])

Terminates when the agent talks to an NPC and advances one full dialogue page. Subgoals: dialogue_initiated -> (termination) dialogue_advanced.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2MenuOpenCloseTestTracker(SwordOfHope2TestTracker):
214class SwordOfHope2MenuOpenCloseTestTracker(SwordOfHope2TestTracker):
215    """
216    Terminates when the agent closes the Power menu and returns to exploration.
217    Starts at default.state (exploration menu showing). The agent must navigate
218    cursor onto Power, open Power, cycle through stat slides, then press B to
219    close back to exploration.
220    Subgoals: power_menu_last_slide -> (termination) exploration_menu.
221    """
222
223    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
224    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2PowerMenuLastSlideSubGoal])

Terminates when the agent closes the Power menu and returns to exploration. Starts at default.state (exploration menu showing). The agent must navigate cursor onto Power, open Power, cycle through stat slides, then press B to close back to exploration. Subgoals: power_menu_last_slide -> (termination) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2FirstAdjacentRoomTestTracker(SwordOfHope2TestTracker):
227class SwordOfHope2FirstAdjacentRoomTestTracker(SwordOfHope2TestTracker):
228    """
229    Terminates when the agent reaches Riccar Castle (first adjacent room from
230    the King's Room). Subgoal: kings_room starting room visible.
231    """
232
233    TERMINATION_TRUNCATION_METRIC = SoH2FirstAdjacentRoomTerminateMetric
234    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2StarterRoomSubGoal])

Terminates when the agent reaches Riccar Castle (first adjacent room from the King's Room). Subgoal: kings_room starting room visible.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2BattleWonTestTracker(SwordOfHope2TestTracker):
237class SwordOfHope2BattleWonTestTracker(SwordOfHope2TestTracker):
238    """
239    Terminates when the agent wins a battle in SoH2.
240    Starts at battle_example.state (battle active at t=0).
241    Subgoals: battle_active -> (termination) battle_won.
242    """
243
244    TERMINATION_TRUNCATION_METRIC = SoH2BattleWonTerminateMetric
245    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])

Terminates when the agent wins a battle in SoH2. Starts at battle_example.state (battle active at t=0). Subgoals: battle_active -> (termination) battle_won.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2EscapeBattleTestTracker(SwordOfHope2TestTracker):
248class SwordOfHope2EscapeBattleTestTracker(SwordOfHope2TestTracker):
249    """
250    Terminates when the agent successfully escapes from a battle in SoH2.
251    Starts at battle_example.state (battle active at t=0).
252    Subgoals: battle_active -> (termination) escape_confirmed.
253    """
254
255    TERMINATION_TRUNCATION_METRIC = SoH2EscapeConfirmedTerminateMetric
256    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])

Terminates when the agent successfully escapes from a battle in SoH2. Starts at battle_example.state (battle active at t=0). Subgoals: battle_active -> (termination) escape_confirmed.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2OpenShopMenuTestTracker(SwordOfHope2TestTracker):
259class SwordOfHope2OpenShopMenuTestTracker(SwordOfHope2TestTracker):
260    """
261    Terminates when the agent opens a shop's buy menu.
262    Starts at shop_example.state (player in front of a shop).
263    No subgoals (single-step interaction).
264    """
265
266    TERMINATION_TRUNCATION_METRIC = SoH2ShopMenuOpenTerminateMetric
267    SUBGOAL_METRIC = DummySubGoalMetric

Terminates when the agent opens a shop's buy menu. Starts at shop_example.state (player in front of a shop). No subgoals (single-step interaction).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2BattleMagicCommandTestTracker(SwordOfHope2TestTracker):
270class SwordOfHope2BattleMagicCommandTestTracker(SwordOfHope2TestTracker):
271    """
272    Terminates when the agent selects MAGIC in battle and the magic submenu shows.
273    Starts at battle_example.state.
274    Subgoals: battle_active -> (termination) battle_magic_menu.
275    """
276
277    TERMINATION_TRUNCATION_METRIC = SoH2BattleMagicMenuTerminateMetric
278    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])

Terminates when the agent selects MAGIC in battle and the magic submenu shows. Starts at battle_example.state. Subgoals: battle_active -> (termination) battle_magic_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2AutoBattleTestTracker(SwordOfHope2TestTracker):
281class SwordOfHope2AutoBattleTestTracker(SwordOfHope2TestTracker):
282    """
283    Terminates when the agent navigates the cursor onto the AUTO command in
284    the battle command row. Tests command-row navigation.
285    Starts at battle_example.state.
286    Subgoals: battle_active -> (termination) cursor_on_auto.
287    """
288
289    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnAutoTerminateMetric
290    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])

Terminates when the agent navigates the cursor onto the AUTO command in the battle command row. Tests command-row navigation. Starts at battle_example.state. Subgoals: battle_active -> (termination) cursor_on_auto.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2OpenItemMenuTestTracker(SwordOfHope2TestTracker):
293class SwordOfHope2OpenItemMenuTestTracker(SwordOfHope2TestTracker):
294    """
295    Terminates when the agent reaches the Use submenu via Item -> Use chain.
296    SoH2 inventory flow: press ITEM (inventory list) -> press A on an item to
297    bring up the Use submenu.
298    Starts at default.state.
299    Subgoals: item_menu_open -> (termination) use_menu_open.
300    """
301
302    TERMINATION_TRUNCATION_METRIC = SoH2UseMenuOpenTerminateMetric
303    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ItemMenuOpenSubGoal])

Terminates when the agent reaches the Use submenu via Item -> Use chain. SoH2 inventory flow: press ITEM (inventory list) -> press A on an item to bring up the Use submenu. Starts at default.state. Subgoals: item_menu_open -> (termination) use_menu_open.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnLookTestTracker(SwordOfHope2TestTracker):
306class SwordOfHope2CursorOnLookTestTracker(SwordOfHope2TestTracker):
307    """Cursor at LOOK in the exploration command grid. Region: status_command."""
308    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnLookTerminateMetric
309    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at LOOK in the exploration command grid. Region: status_command.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnItemTestTracker(SwordOfHope2TestTracker):
312class SwordOfHope2CursorOnItemTestTracker(SwordOfHope2TestTracker):
313    """Cursor at ITEM in the exploration command grid."""
314    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnItemTerminateMetric
315    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at ITEM in the exploration command grid.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnOpenTestTracker(SwordOfHope2TestTracker):
318class SwordOfHope2CursorOnOpenTestTracker(SwordOfHope2TestTracker):
319    """Cursor at OPEN in the exploration command grid."""
320    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnOpenTerminateMetric
321    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at OPEN in the exploration command grid.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnMagicTestTracker(SwordOfHope2TestTracker):
324class SwordOfHope2CursorOnMagicTestTracker(SwordOfHope2TestTracker):
325    """Cursor at MAGIC in the exploration command grid."""
326    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnMagicTerminateMetric
327    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at MAGIC in the exploration command grid.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnHitTestTracker(SwordOfHope2TestTracker):
330class SwordOfHope2CursorOnHitTestTracker(SwordOfHope2TestTracker):
331    """Cursor at HIT in the exploration command grid."""
332    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnHitTerminateMetric
333    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at HIT in the exploration command grid.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CycleThroughCommandsTestTracker(SwordOfHope2TestTracker):
336class SwordOfHope2CycleThroughCommandsTestTracker(SwordOfHope2TestTracker):
337    """
338    Terminates when the agent has cycled the cursor through all 6 commands
339    in order (LOOK -> ITEM -> OPEN -> MAGIC -> HIT -> POWER) without pressing
340    A on any of them.
341    Starts at default.state.
342    Subgoals: cursor_on_look -> cursor_on_item -> cursor_on_open
343              -> cursor_on_magic -> cursor_on_hit
344              -> (termination) cursor_on_power.
345    """
346
347    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnPowerTerminateMetric
348    SUBGOAL_METRIC = make_subgoal_metric_class(
349        [
350            SoH2CursorOnLookSubGoal,
351            SoH2CursorOnItemSubGoal,
352            SoH2CursorOnOpenSubGoal,
353            SoH2CursorOnMagicSubGoal,
354            SoH2CursorOnHitSubGoal,
355        ]
356    )

Terminates when the agent has cycled the cursor through all 6 commands in order (LOOK -> ITEM -> OPEN -> MAGIC -> HIT -> POWER) without pressing A on any of them. Starts at default.state. Subgoals: cursor_on_look -> cursor_on_item -> cursor_on_open -> cursor_on_magic -> cursor_on_hit -> (termination) cursor_on_power.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2ViewExpNeededTestTracker(SwordOfHope2TestTracker):
359class SwordOfHope2ViewExpNeededTestTracker(SwordOfHope2TestTracker):
360    """
361    Terminates when the agent reaches the Power stats page that shows
362    "X more EXP needed for level up". Full chain: navigate to Power in
363    command grid -> open Power menu (first stats page) -> cycle to last
364    EXP page.
365    Starts at lvl3_overworld.state (Theo at lvl 3, stable overworld).
366    Subgoals: cursor_on_power -> power_stats_first_page
367              -> (termination) power_stats_exp_page.
368    """
369
370    TERMINATION_TRUNCATION_METRIC = SoH2PowerStatsExpPageTerminateMetric
371    SUBGOAL_METRIC = make_subgoal_metric_class(
372        [SoH2CursorOnPowerSubGoal, SoH2PowerStatsFirstPageSubGoal]
373    )

Terminates when the agent reaches the Power stats page that shows "X more EXP needed for level up". Full chain: navigate to Power in command grid -> open Power menu (first stats page) -> cycle to last EXP page. Starts at lvl3_overworld.state (Theo at lvl 3, stable overworld). Subgoals: cursor_on_power -> power_stats_first_page -> (termination) power_stats_exp_page.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2UseWheatTestTracker(SwordOfHope2TestTracker):
376class SwordOfHope2UseWheatTestTracker(SwordOfHope2TestTracker):
377    """
378    Terminates when the agent uses Wheat from inventory and consumes it.
379    Full chain: ITEM submenu -> cursor on Wheat -> press A (Use submenu) ->
380    confirm USE -> wheat consumption dialogue.
381    Starts at wheat_in_inventory.state (player has Wheat in inventory at a
382    stable overworld position).
383    Subgoals: item_menu_open -> cursor_on_wheat -> use_menu_open
384              -> (termination) wheat_consumed.
385    """
386
387    TERMINATION_TRUNCATION_METRIC = SoH2WheatConsumedTerminateMetric
388    SUBGOAL_METRIC = make_subgoal_metric_class(
389        [SoH2ItemMenuOpenSubGoal, SoH2CursorOnWheatSubGoal, SoH2UseMenuOpenSubGoal]
390    )

Terminates when the agent uses Wheat from inventory and consumes it. Full chain: ITEM submenu -> cursor on Wheat -> press A (Use submenu) -> confirm USE -> wheat consumption dialogue. Starts at wheat_in_inventory.state (player has Wheat in inventory at a stable overworld position). Subgoals: item_menu_open -> cursor_on_wheat -> use_menu_open -> (termination) wheat_consumed.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2HitTreeWheatTestTracker(SwordOfHope2TestTracker):
393class SwordOfHope2HitTreeWheatTestTracker(SwordOfHope2TestTracker):
394    """
395    Terminates when the agent uses Hit on a tree at Riccar Woods [A4] and
396    receives Wheat. Wheat drops are randomized — may take 1, 2, or more
397    hits — so the agent must keep Hitting until the wheat dialogue appears.
398    Starts at hit_tree_example.state (player adjacent to the [A4] tree).
399    Subgoals: hit_tree_target -> (termination) wheat_from_tree.
400    """
401
402    TERMINATION_TRUNCATION_METRIC = SoH2WheatFromTreeTerminateMetric
403    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2HitTreeTargetSubGoal])

Terminates when the agent uses Hit on a tree at Riccar Woods [A4] and receives Wheat. Wheat drops are randomized — may take 1, 2, or more hits — so the agent must keep Hitting until the wheat dialogue appears. Starts at hit_tree_example.state (player adjacent to the [A4] tree). Subgoals: hit_tree_target -> (termination) wheat_from_tree.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CastMotionTestTracker(SwordOfHope2TestTracker):
406class SwordOfHope2CastMotionTestTracker(SwordOfHope2TestTracker):
407    """
408    Terminates when the agent casts Motion magic from the overworld.
409    Starts at lvl2_overworld.state (Theo at level 2 with Motion spell available).
410    Subgoals: magic_menu_open -> (termination) motion_result.
411    """
412
413    TERMINATION_TRUNCATION_METRIC = SoH2MotionResultTerminateMetric
414    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2MagicMenuOpenSubGoal])

Terminates when the agent casts Motion magic from the overworld. Starts at lvl2_overworld.state (Theo at level 2 with Motion spell available). Subgoals: magic_menu_open -> (termination) motion_result.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2BuyWheatTestTracker(SwordOfHope2TestTracker):
417class SwordOfHope2BuyWheatTestTracker(SwordOfHope2TestTracker):
418    """
419    Terminates when the agent buys Wheat from a shop in SoH2.
420    Starts at shop_example.state (player in front of a shop, ready to interact).
421    Wheat is item-specific because the post-buy dialogue contains the item name
422    ("WHEAT? Thank you"), so the capture is keyed to wheat.
423    Subgoals: shop_menu_open -> (termination) wheat_purchased.
424    """
425
426    TERMINATION_TRUNCATION_METRIC = SoH2WheatPurchasedTerminateMetric
427    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ShopMenuOpenSubGoal])

Terminates when the agent buys Wheat from a shop in SoH2. Starts at shop_example.state (player in front of a shop, ready to interact). Wheat is item-specific because the post-buy dialogue contains the item name ("WHEAT? Thank you"), so the capture is keyed to wheat. Subgoals: shop_menu_open -> (termination) wheat_purchased.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2BuyCprSwordTestTracker(SwordOfHope2TestTracker):
430class SwordOfHope2BuyCprSwordTestTracker(SwordOfHope2TestTracker):
431    """
432    Terminates when the agent buys the CPR Sword (3rd item) from the Weapons Shop.
433    Starts at weapons_shop_example.state (player adjacent to the shopkeeper, ready to Look).
434    Multi-step interaction:
435      1. Look menu with cursor on shopkeeper
436      2. After A on shopkeeper, BUY/SELL choice menu
437      3. After picking BUY, item list visible (cursor on first item)
438      4. Cursor navigated down to CPR Sword (3rd entry)
439      5. After confirming, "CPR SWORD? Thank you"
440    Subgoals: look_shopkeeper -> shop_buy_sell_menu -> weapons_shop_menu_open
441              -> cursor_on_cpr_sword -> (termination) cpr_sword_purchased.
442    """
443
444    TERMINATION_TRUNCATION_METRIC = SoH2CprSwordPurchasedTerminateMetric
445    SUBGOAL_METRIC = make_subgoal_metric_class(
446        [
447            SoH2LookShopkeeperSubGoal,
448            SoH2ShopBuySellMenuSubGoal,
449            SoH2WeaponsShopMenuOpenSubGoal,
450            SoH2CursorOnCprSwordSubGoal,
451        ]
452    )

Terminates when the agent buys the CPR Sword (3rd item) from the Weapons Shop. Starts at weapons_shop_example.state (player adjacent to the shopkeeper, ready to Look). Multi-step interaction:

  1. Look menu with cursor on shopkeeper
  2. After A on shopkeeper, BUY/SELL choice menu
  3. After picking BUY, item list visible (cursor on first item)
  4. Cursor navigated down to CPR Sword (3rd entry)
  5. After confirming, "CPR SWORD? Thank you" Subgoals: look_shopkeeper -> shop_buy_sell_menu -> weapons_shop_menu_open -> cursor_on_cpr_sword -> (termination) cpr_sword_purchased.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2OverworldFromDefaultTestTracker(SwordOfHope2TestTracker):
455class SwordOfHope2OverworldFromDefaultTestTracker(SwordOfHope2TestTracker):
456    """
457    Terminates when the agent reaches a stable overworld position with no open
458    dialogue or menu (the Look/Open/Hit/Use/Magic/Power command grid is showing).
459    Subgoals: dialogue_visible -> (termination) exploration_menu.
460    """
461
462    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
463    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2DialogueVisibleSubGoal])

Terminates when the agent reaches a stable overworld position with no open dialogue or menu (the Look/Open/Hit/Use/Magic/Power command grid is showing). Subgoals: dialogue_visible -> (termination) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnPowerTestTracker(SwordOfHope2TestTracker):
466class SwordOfHope2CursorOnPowerTestTracker(SwordOfHope2TestTracker):
467    """Cursor at POWER in the exploration command grid. Region: status_command."""
468    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnPowerTerminateMetric
469    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at POWER in the exploration command grid. Region: status_command.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2PowerFirstPageTestTracker(SwordOfHope2TestTracker):
472class SwordOfHope2PowerFirstPageTestTracker(SwordOfHope2TestTracker):
473    """
474    Terminates when the agent reaches the Power stats first page.
475    Shorter scope than view_exp_needed_test (which cycles past the first page).
476    Starts at default.state.
477    Subgoals: cursor_on_power -> (termination) power_stats_first_page.
478    """
479
480    TERMINATION_TRUNCATION_METRIC = SoH2PowerStatsFirstPageTerminateMetric
481    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnPowerSubGoal])

Terminates when the agent reaches the Power stats first page. Shorter scope than view_exp_needed_test (which cycles past the first page). Starts at default.state. Subgoals: cursor_on_power -> (termination) power_stats_first_page.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2OpenMagicMenuTestTracker(SwordOfHope2TestTracker):
484class SwordOfHope2OpenMagicMenuTestTracker(SwordOfHope2TestTracker):
485    """
486    Terminates when the agent opens the Magic submenu from exploration.
487    Starts at default.state.
488    Subgoals: cursor_on_magic -> (termination) magic_menu_open.
489    """
490
491    TERMINATION_TRUNCATION_METRIC = SoH2MagicMenuOpenTerminateMetric
492    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnMagicSubGoal])

Terminates when the agent opens the Magic submenu from exploration. Starts at default.state. Subgoals: cursor_on_magic -> (termination) magic_menu_open.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2OpenItemViewTestTracker(SwordOfHope2TestTracker):
495class SwordOfHope2OpenItemViewTestTracker(SwordOfHope2TestTracker):
496    """
497    Terminates when the agent opens the Item (inventory) submenu.
498    Shorter scope than open_item_menu_test (which proceeds to the Use submenu).
499    Starts at default.state.
500    Subgoals: cursor_on_item -> (termination) item_menu_open.
501    """
502
503    TERMINATION_TRUNCATION_METRIC = SoH2ItemMenuOpenTerminateMetric
504    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnItemSubGoal])

Terminates when the agent opens the Item (inventory) submenu. Shorter scope than open_item_menu_test (which proceeds to the Use submenu). Starts at default.state. Subgoals: cursor_on_item -> (termination) item_menu_open.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2LookShopkeeperTestTracker(SwordOfHope2TestTracker):
507class SwordOfHope2LookShopkeeperTestTracker(SwordOfHope2TestTracker):
508    """
509    Terminates when the agent looks at the weapons-shop shopkeeper (Look menu
510    with cursor on shopkeeper visible).
511    Starts at weapons_shop_example.state (player adjacent to the shopkeeper).
512    Subgoals: cursor_on_look -> (termination) look_shopkeeper.
513    """
514
515    TERMINATION_TRUNCATION_METRIC = SoH2LookShopkeeperTerminateMetric
516    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnLookSubGoal])

Terminates when the agent looks at the weapons-shop shopkeeper (Look menu with cursor on shopkeeper visible). Starts at weapons_shop_example.state (player adjacent to the shopkeeper). Subgoals: cursor_on_look -> (termination) look_shopkeeper.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2OpenWeaponsShopBuyTestTracker(SwordOfHope2TestTracker):
519class SwordOfHope2OpenWeaponsShopBuyTestTracker(SwordOfHope2TestTracker):
520    """
521    Terminates when the agent reaches the weapons shop's BUY item list.
522    Shorter scope than buy_cpr_sword_test.
523    Starts at weapons_shop_example.state.
524    Subgoals: shop_buy_sell_menu -> (termination) weapons_shop_menu_open.
525    """
526
527    TERMINATION_TRUNCATION_METRIC = SoH2WeaponsShopMenuOpenTerminateMetric
528    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ShopBuySellMenuSubGoal])

Terminates when the agent reaches the weapons shop's BUY item list. Shorter scope than buy_cpr_sword_test. Starts at weapons_shop_example.state. Subgoals: shop_buy_sell_menu -> (termination) weapons_shop_menu_open.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnCprSwordTestTracker(SwordOfHope2TestTracker):
531class SwordOfHope2CursorOnCprSwordTestTracker(SwordOfHope2TestTracker):
532    """
533    Terminates when the cursor is on CPR Sword (3rd entry) in the weapons shop
534    item list. Shorter scope than buy_cpr_sword_test (no purchase confirmation).
535    Starts at weapons_shop_example.state.
536    Subgoals: weapons_shop_menu_open -> (termination) cursor_on_cpr_sword.
537    """
538
539    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnCprSwordTerminateMetric
540    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2WeaponsShopMenuOpenSubGoal])

Terminates when the cursor is on CPR Sword (3rd entry) in the weapons shop item list. Shorter scope than buy_cpr_sword_test (no purchase confirmation). Starts at weapons_shop_example.state. Subgoals: weapons_shop_menu_open -> (termination) cursor_on_cpr_sword.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2OpenUseMenuTestTracker(SwordOfHope2TestTracker):
543class SwordOfHope2OpenUseMenuTestTracker(SwordOfHope2TestTracker):
544    """
545    Terminates when the Use submenu opens after selecting a usable item.
546    Shorter scope than use_wheat_test (which proceeds to wheat consumption).
547    Starts at hit_tree_example.state (Wheat in inventory).
548    Subgoals: item_menu_open -> cursor_on_wheat -> (termination) use_menu_open.
549    """
550
551    TERMINATION_TRUNCATION_METRIC = SoH2UseMenuOpenTerminateMetric
552    SUBGOAL_METRIC = make_subgoal_metric_class(
553        [SoH2ItemMenuOpenSubGoal, SoH2CursorOnWheatSubGoal]
554    )

Terminates when the Use submenu opens after selecting a usable item. Shorter scope than use_wheat_test (which proceeds to wheat consumption). Starts at hit_tree_example.state (Wheat in inventory). Subgoals: item_menu_open -> cursor_on_wheat -> (termination) use_menu_open.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2OpenShopBuySellTestTracker(SwordOfHope2TestTracker):
557class SwordOfHope2OpenShopBuySellTestTracker(SwordOfHope2TestTracker):
558    """
559    Terminates when the BUY/SELL choice menu opens after engaging the
560    shopkeeper. Shorter scope than open_weapons_shop_buy_test (which proceeds
561    to the BUY item list).
562    Starts at weapons_shop_example.state.
563    Subgoals: look_shopkeeper -> (termination) shop_buy_sell_menu.
564    """
565
566    TERMINATION_TRUNCATION_METRIC = SoH2ShopBuySellMenuTerminateMetric
567    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2LookShopkeeperSubGoal])

Terminates when the BUY/SELL choice menu opens after engaging the shopkeeper. Shorter scope than open_weapons_shop_buy_test (which proceeds to the BUY item list). Starts at weapons_shop_example.state. Subgoals: look_shopkeeper -> (termination) shop_buy_sell_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnWheatTestTracker(SwordOfHope2TestTracker):
570class SwordOfHope2CursorOnWheatTestTracker(SwordOfHope2TestTracker):
571    """
572    Terminates when the cursor lands on Wheat in the Item submenu.
573    Shorter scope than use_wheat_test (which proceeds to consumption).
574    Starts at hit_tree_example.state.
575    Subgoals: item_menu_open -> (termination) cursor_on_wheat.
576    """
577
578    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnWheatTerminateMetric
579    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ItemMenuOpenSubGoal])

Terminates when the cursor lands on Wheat in the Item submenu. Shorter scope than use_wheat_test (which proceeds to consumption). Starts at hit_tree_example.state. Subgoals: item_menu_open -> (termination) cursor_on_wheat.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2BattleClashTestTracker(SwordOfHope2TestTracker):
582class SwordOfHope2BattleClashTestTracker(SwordOfHope2TestTracker):
583    """
584    Terminates when the cursor lands on CLASH in the battle command row.
585    Mirror of cursor_on_auto_test but for the default attack command.
586    Starts at battle_example.state.
587    Subgoals: battle_active -> (termination) cursor_on_clash.
588    """
589
590    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnClashTerminateMetric
591    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2BattleActiveSubGoal])

Terminates when the cursor lands on CLASH in the battle command row. Mirror of cursor_on_auto_test but for the default attack command. Starts at battle_example.state. Subgoals: battle_active -> (termination) cursor_on_clash.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2EnterTempleFirstFloorTestTracker(SwordOfHope2TestTracker):
594class SwordOfHope2EnterTempleFirstFloorTestTracker(SwordOfHope2TestTracker):
595    """
596    Terminates when the agent reaches the Ancient Temple's 1st floor from
597    outside the temple entrance. Story event #1 in SoH2 — leave Castle,
598    find Ancient Temple. Starts at outside_temple.state.
599    Subgoals: outside_temple -> (termination) temple_1f.
600    """
601
602    TERMINATION_TRUNCATION_METRIC = SoH2Temple1fTerminateMetric
603    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2OutsideTempleSubGoal])

Terminates when the agent reaches the Ancient Temple's 1st floor from outside the temple entrance. Story event #1 in SoH2 — leave Castle, find Ancient Temple. Starts at outside_temple.state. Subgoals: outside_temple -> (termination) temple_1f.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1MillRoomTestTracker(SwordOfHope1TestTracker):
606class SwordOfHope1MillRoomTestTracker(SwordOfHope1TestTracker):
607    """
608    Terminates when the agent reaches the Mill Room (first adjacent room from start).
609    """
610
611    TERMINATION_TRUNCATION_METRIC = MillRoomTerminateMetric
612    SUBGOAL_METRIC = DummySubGoalMetric

Terminates when the agent reaches the Mill Room (first adjacent room from start).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1ShamanRoomTestTracker(SwordOfHope1TestTracker):
615class SwordOfHope1ShamanRoomTestTracker(SwordOfHope1TestTracker):
616    """
617    Terminates when the agent reaches the Shaman's Room.
618    Subgoals: in_forest -> shaman_house -> (termination) shaman_room.
619    """
620
621    TERMINATION_TRUNCATION_METRIC = ShamanRoomTerminateMetric
622    SUBGOAL_METRIC = make_subgoal_metric_class([OldmanHouseSubGoal, InForestSubGoal, ShamanHouseSubGoal])

Terminates when the agent reaches the Shaman's Room. Subgoals: in_forest -> shaman_house -> (termination) shaman_room.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1DialogueClearTestTracker(SwordOfHope1TestTracker):
625class SwordOfHope1DialogueClearTestTracker(SwordOfHope1TestTracker):
626    """
627    Terminates when the dialogue is cleared and control returns to the player.
628    Subgoals: dialogue_active -> (termination) dialogue_cleared.
629    """
630
631    TERMINATION_TRUNCATION_METRIC = DialogueClearedTerminateMetric
632    SUBGOAL_METRIC = make_subgoal_metric_class([DialogueActiveSubGoal])

Terminates when the dialogue is cleared and control returns to the player. Subgoals: dialogue_active -> (termination) dialogue_cleared.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1BattleWonTestTracker(SwordOfHope1TestTracker):
635class SwordOfHope1BattleWonTestTracker(SwordOfHope1TestTracker):
636    """
637    Terminates when the battle is won.
638    Subgoals: battle_active -> (termination) battle_won.
639    """
640
641    TERMINATION_TRUNCATION_METRIC = BattleWonTerminateMetric
642    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])

Terminates when the battle is won. Subgoals: battle_active -> (termination) battle_won.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1LookItemTestTracker(SwordOfHope1TestTracker):
645class SwordOfHope1LookItemTestTracker(SwordOfHope1TestTracker):
646    """
647    Terminates when a hidden item is found by looking at an object.
648    Subgoals: look_selected -> look_target_options -> (termination) item_found.
649    """
650
651    TERMINATION_TRUNCATION_METRIC = ItemFoundTerminateMetric
652    SUBGOAL_METRIC = make_subgoal_metric_class([LookSelectedSubGoal, LookTargetOptionsSubGoal])

Terminates when a hidden item is found by looking at an object. Subgoals: look_selected -> look_target_options -> (termination) item_found.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1BuyItemTestTracker(SwordOfHope1TestTracker):
655class SwordOfHope1BuyItemTestTracker(SwordOfHope1TestTracker):
656    """
657    Terminates when an item is purchased from a shop.
658    Subgoals: shop_menu_open -> (termination) purchase_confirmed.
659    """
660
661    TERMINATION_TRUNCATION_METRIC = PurchaseConfirmedTerminateMetric
662    SUBGOAL_METRIC = make_subgoal_metric_class([ShopMenuOpenSubGoal])

Terminates when an item is purchased from a shop. Subgoals: shop_menu_open -> (termination) purchase_confirmed.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1OverworldFromDefaultTestTracker(SwordOfHope1TestTracker):
665class SwordOfHope1OverworldFromDefaultTestTracker(SwordOfHope1TestTracker):
666    """
667    Terminates when the agent reaches a stable overworld position with no open
668    dialogue or menu (the Look/Open/Hit/Use/Magic/Power command grid is showing).
669    Subgoals: dialogue_visible -> (termination) exploration_menu.
670    """
671
672    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
673    SUBGOAL_METRIC = make_subgoal_metric_class([DialogueVisibleSubGoal])

Terminates when the agent reaches a stable overworld position with no open dialogue or menu (the Look/Open/Hit/Use/Magic/Power command grid is showing). Subgoals: dialogue_visible -> (termination) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1TalkToNpcTestTracker(SwordOfHope1TestTracker):
676class SwordOfHope1TalkToNpcTestTracker(SwordOfHope1TestTracker):
677    """
678    Terminates when the agent talks to an NPC and advances one full dialogue page.
679    Subgoals: dialogue_initiated -> (termination) dialogue_advanced.
680    """
681
682    TERMINATION_TRUNCATION_METRIC = DialogueAdvancedTerminateMetric
683    SUBGOAL_METRIC = make_subgoal_metric_class([DialogueInitiatedSubGoal])

Terminates when the agent talks to an NPC and advances one full dialogue page. Subgoals: dialogue_initiated -> (termination) dialogue_advanced.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1MenuOpenCloseTestTracker(SwordOfHope1TestTracker):
686class SwordOfHope1MenuOpenCloseTestTracker(SwordOfHope1TestTracker):
687    """
688    Terminates when the agent closes an open menu and returns to exploration.
689    Starts at menu_example.state (menu already open at t=0).
690    Subgoals: menu_open -> (termination) exploration_menu.
691    """
692
693    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
694    SUBGOAL_METRIC = make_subgoal_metric_class([MenuOpenSubGoal])

Terminates when the agent closes an open menu and returns to exploration. Starts at menu_example.state (menu already open at t=0). Subgoals: menu_open -> (termination) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1BattleMagicCommandTestTracker(SwordOfHope1TestTracker):
697class SwordOfHope1BattleMagicCommandTestTracker(SwordOfHope1TestTracker):
698    """
699    Terminates when the agent selects a non-default battle command (Magic submenu open).
700    Starts at battle_example.state (battle active at t=0, FIGHT menu default).
701    Subgoals: battle_active -> (termination) battle_magic_menu.
702    """
703
704    TERMINATION_TRUNCATION_METRIC = BattleMagicMenuTerminateMetric
705    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])

Terminates when the agent selects a non-default battle command (Magic submenu open). Starts at battle_example.state (battle active at t=0, FIGHT menu default). Subgoals: battle_active -> (termination) battle_magic_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CastTeleportTestTracker(SwordOfHope1TestTracker):
708class SwordOfHope1CastTeleportTestTracker(SwordOfHope1TestTracker):
709    """
710    Terminates when the agent opens Magic, selects Teleport and sees the result
711    (destination list or 'cannot teleport' message).
712    Starts at default.state (stable overworld, Lvl 1).
713    Subgoals: magic_menu_open -> (termination) teleport_result.
714    """
715
716    TERMINATION_TRUNCATION_METRIC = TeleportResultTerminateMetric
717    SUBGOAL_METRIC = make_subgoal_metric_class([MagicMenuOpenSubGoal])

Terminates when the agent opens Magic, selects Teleport and sees the result (destination list or 'cannot teleport' message). Starts at default.state (stable overworld, Lvl 1). Subgoals: magic_menu_open -> (termination) teleport_result.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1TalkToNpcMultipleTestTracker(SwordOfHope1TestTracker):
720class SwordOfHope1TalkToNpcMultipleTestTracker(SwordOfHope1TestTracker):
721    """
722    Terminates when the agent talks to the same NPC twice and sees a distinct
723    second-visit dialogue (progression event, e.g. Mistress giving Scroll of Grace).
724    Starts at shop_forest.state (near the Mistress at the Forest Shop).
725    Subgoals: mistress_first_dialogue -> (termination) mistress_second_dialogue.
726    """
727
728    TERMINATION_TRUNCATION_METRIC = MistressSecondDialogueTerminateMetric
729    SUBGOAL_METRIC = make_subgoal_metric_class([MistressFirstDialogueSubGoal])

Terminates when the agent talks to the same NPC twice and sees a distinct second-visit dialogue (progression event, e.g. Mistress giving Scroll of Grace). Starts at shop_forest.state (near the Mistress at the Forest Shop). Subgoals: mistress_first_dialogue -> (termination) mistress_second_dialogue.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1BinaryChoiceSaveTestTracker(SwordOfHope1TestTracker):
732class SwordOfHope1BinaryChoiceSaveTestTracker(SwordOfHope1TestTracker):
733    """
734    Terminates when the agent answers Yes to the Shaman's save prompt.
735    Starts at at_shaman.state (player in front of Shaman, ready to talk).
736    Subgoals: save_prompt_visible -> (termination) save_confirmed.
737    """
738
739    TERMINATION_TRUNCATION_METRIC = SaveConfirmedTerminateMetric
740    SUBGOAL_METRIC = make_subgoal_metric_class([SavePromptVisibleSubGoal])

Terminates when the agent answers Yes to the Shaman's save prompt. Starts at at_shaman.state (player in front of Shaman, ready to talk). Subgoals: save_prompt_visible -> (termination) save_confirmed.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1LookSurroundHerbTestTracker(SwordOfHope1TestTracker):
743class SwordOfHope1LookSurroundHerbTestTracker(SwordOfHope1TestTracker):
744    """
745    Terminates when the agent Looks at the Path target at Old Man's Forest [C5]
746    and receives a Herb.
747    Starts at forest_c5.state (player at [C5] in Old Man's Forest).
748    Subgoals: look_path_target -> (termination) herb_received.
749    """
750
751    TERMINATION_TRUNCATION_METRIC = HerbReceivedTerminateMetric
752    SUBGOAL_METRIC = make_subgoal_metric_class([LookPathTargetSubGoal])

Terminates when the agent Looks at the Path target at Old Man's Forest [C5] and receives a Herb. Starts at forest_c5.state (player at [C5] in Old Man's Forest). Subgoals: look_path_target -> (termination) herb_received.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1DefeatTreantTestTracker(SwordOfHope1TestTracker):
755class SwordOfHope1DefeatTreantTestTracker(SwordOfHope1TestTracker):
756    """
757    Terminates when the agent defeats Treant in battle (walkthrough event #2),
758    receiving Key M. Uses offensive magic (Firebal2 strategy, lvl 4+).
759    Starts at treant_battle_start.state (Treant battle active, FIGHT menu default).
760    Subgoals: battle_active -> (termination) treant_defeated.
761    """
762
763    TERMINATION_TRUNCATION_METRIC = TreantDefeatedTerminateMetric
764    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])

Terminates when the agent defeats Treant in battle (walkthrough event #2), receiving Key M. Uses offensive magic (Firebal2 strategy, lvl 4+). Starts at treant_battle_start.state (Treant battle active, FIGHT menu default). Subgoals: battle_active -> (termination) treant_defeated.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1UseKeyUnlockTestTracker(SwordOfHope1TestTracker):
767class SwordOfHope1UseKeyUnlockTestTracker(SwordOfHope1TestTracker):
768    """
769    Terminates when the agent uses Key M at the Martel's Domain gate ([A4] in
770    Old Man's Forest) and unlocks the passage to Martel's Domain.
771    Starts at at_martel_gate.state (player at [A4] with Key M in inventory, gate still locked).
772    Subgoals: key_m_selected -> (termination) gate_opened.
773    """
774
775    TERMINATION_TRUNCATION_METRIC = GateOpenedTerminateMetric
776    SUBGOAL_METRIC = make_subgoal_metric_class([KeyMSelectedSubGoal])

Terminates when the agent uses Key M at the Martel's Domain gate ([A4] in Old Man's Forest) and unlocks the passage to Martel's Domain. Starts at at_martel_gate.state (player at [A4] with Key M in inventory, gate still locked). Subgoals: key_m_selected -> (termination) gate_opened.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CollectScrollGraceTestTracker(SwordOfHope1TestTracker):
779class SwordOfHope1CollectScrollGraceTestTracker(SwordOfHope1TestTracker):
780    """
781    Terminates when the agent picks up the Scroll of Grace from the Forest Shop
782    backroom (Old Man's Forest [E2]) after talking to the Mistress twice.
783    Starts at mistress_backroom_access.state (player inside the backroom).
784    Subgoals: in_backroom -> (termination) scroll_received.
785    """
786
787    TERMINATION_TRUNCATION_METRIC = ScrollReceivedTerminateMetric
788    SUBGOAL_METRIC = make_subgoal_metric_class([InBackroomSubGoal])

Terminates when the agent picks up the Scroll of Grace from the Forest Shop backroom (Old Man's Forest [E2]) after talking to the Mistress twice. Starts at mistress_backroom_access.state (player inside the backroom). Subgoals: in_backroom -> (termination) scroll_received.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CastGraceAltarTestTracker(SwordOfHope1TestTracker):
791class SwordOfHope1CastGraceAltarTestTracker(SwordOfHope1TestTracker):
792    """
793    Terminates when the agent casts the Grace spell at the Martel's Domain [F3]
794    altar and receives the Charm (walkthrough event #4).
795    Starts at at_martel_altar.state (player at [F3] with Scroll of Grace in inventory).
796    Subgoals: grace_selected -> (termination) charm_received.
797    """
798
799    TERMINATION_TRUNCATION_METRIC = CharmReceivedTerminateMetric
800    SUBGOAL_METRIC = make_subgoal_metric_class([GraceSelectedSubGoal])

Terminates when the agent casts the Grace spell at the Martel's Domain [F3] altar and receives the Charm (walkthrough event #4). Starts at at_martel_altar.state (player at [F3] with Scroll of Grace in inventory). Subgoals: grace_selected -> (termination) charm_received.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CompleteTeleportTestTracker(SwordOfHope1TestTracker):
803class SwordOfHope1CompleteTeleportTestTracker(SwordOfHope1TestTracker):
804    """
805    Terminates when the agent completes a Teleport cast and lands at a destination.
806    Starts from an overworld state (e.g. default).
807    Subgoals: teleport_dest_cursor (destination list visible with cursor on a dest)
808    -> (termination) teleport_landed (post-teleport command_area state).
809    """
810
811    TERMINATION_TRUNCATION_METRIC = TeleportLandedTerminateMetric
812    SUBGOAL_METRIC = make_subgoal_metric_class([TeleportDestCursorSubGoal])

Terminates when the agent completes a Teleport cast and lands at a destination. Starts from an overworld state (e.g. default). Subgoals: teleport_dest_cursor (destination list visible with cursor on a dest) -> (termination) teleport_landed (post-teleport command_area state).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1EscapeBattleTestTracker(SwordOfHope1TestTracker):
815class SwordOfHope1EscapeBattleTestTracker(SwordOfHope1TestTracker):
816    """
817    Terminates when the agent successfully Escapes from a battle.
818    Starts at battle_example.state (battle active at t=0).
819    Subgoals: battle_active -> (termination) escape_confirmed
820    (e.g. "You escaped!" or post-escape battle_command state).
821    """
822
823    TERMINATION_TRUNCATION_METRIC = EscapeConfirmedTerminateMetric
824    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])

Terminates when the agent successfully Escapes from a battle. Starts at battle_example.state (battle active at t=0). Subgoals: battle_active -> (termination) escape_confirmed (e.g. "You escaped!" or post-escape battle_command state).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnLookTestTracker(SwordOfHope1TestTracker):
827class SwordOfHope1CursorOnLookTestTracker(SwordOfHope1TestTracker):
828    """Cursor at LOOK in the exploration command grid. Region: status_command."""
829    TERMINATION_TRUNCATION_METRIC = CursorOnLookTerminateMetric
830    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at LOOK in the exploration command grid. Region: status_command.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnOpenTestTracker(SwordOfHope1TestTracker):
833class SwordOfHope1CursorOnOpenTestTracker(SwordOfHope1TestTracker):
834    """Cursor at OPEN in the exploration command grid."""
835    TERMINATION_TRUNCATION_METRIC = CursorOnOpenTerminateMetric
836    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at OPEN in the exploration command grid.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnUseTestTracker(SwordOfHope1TestTracker):
839class SwordOfHope1CursorOnUseTestTracker(SwordOfHope1TestTracker):
840    """Cursor at USE in the exploration command grid."""
841    TERMINATION_TRUNCATION_METRIC = CursorOnUseTerminateMetric
842    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at USE in the exploration command grid.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnMagicTestTracker(SwordOfHope1TestTracker):
845class SwordOfHope1CursorOnMagicTestTracker(SwordOfHope1TestTracker):
846    """Cursor at MAGIC in the exploration command grid."""
847    TERMINATION_TRUNCATION_METRIC = CursorOnMagicTerminateMetric
848    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at MAGIC in the exploration command grid.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnHitTestTracker(SwordOfHope1TestTracker):
851class SwordOfHope1CursorOnHitTestTracker(SwordOfHope1TestTracker):
852    """Cursor at HIT in the exploration command grid."""
853    TERMINATION_TRUNCATION_METRIC = CursorOnHitTerminateMetric
854    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at HIT in the exploration command grid.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnPowerTestTracker(SwordOfHope1TestTracker):
857class SwordOfHope1CursorOnPowerTestTracker(SwordOfHope1TestTracker):
858    """Cursor at POWER in the exploration command grid."""
859    TERMINATION_TRUNCATION_METRIC = CursorOnPowerTerminateMetric
860    SUBGOAL_METRIC = DummySubGoalMetric

Cursor at POWER in the exploration command grid.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CycleThroughCommandsTestTracker(SwordOfHope1TestTracker):
863class SwordOfHope1CycleThroughCommandsTestTracker(SwordOfHope1TestTracker):
864    """
865    Terminates when the agent has cycled the cursor through all 6 commands
866    in order (LOOK -> OPEN -> USE -> MAGIC -> HIT -> POWER) without pressing
867    A on any of them.
868    Starts at default.state.
869    Subgoals: cursor_on_look -> cursor_on_open -> cursor_on_use
870              -> cursor_on_magic -> cursor_on_hit
871              -> (termination) cursor_on_power.
872    """
873
874    TERMINATION_TRUNCATION_METRIC = CursorOnPowerTerminateMetric
875    SUBGOAL_METRIC = make_subgoal_metric_class(
876        [
877            CursorOnLookSubGoal,
878            CursorOnOpenSubGoal,
879            CursorOnUseSubGoal,
880            CursorOnMagicSubGoal,
881            CursorOnHitSubGoal,
882        ]
883    )

Terminates when the agent has cycled the cursor through all 6 commands in order (LOOK -> OPEN -> USE -> MAGIC -> HIT -> POWER) without pressing A on any of them. Starts at default.state. Subgoals: cursor_on_look -> cursor_on_open -> cursor_on_use -> cursor_on_magic -> cursor_on_hit -> (termination) cursor_on_power.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1OpenStatusViewTestTracker(SwordOfHope1TestTracker):
886class SwordOfHope1OpenStatusViewTestTracker(SwordOfHope1TestTracker):
887    """
888    Terminates when the agent reaches the Power menu's first stats page.
889    Full chain: navigate cursor to Power in command grid -> press A to open
890    Power -> first stats page visible.
891    Starts at default.state.
892    Subgoals: cursor_on_power -> (termination) power_stats_first_page.
893    """
894
895    TERMINATION_TRUNCATION_METRIC = PowerStatsFirstPageTerminateMetric
896    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnPowerSubGoal])

Terminates when the agent reaches the Power menu's first stats page. Full chain: navigate cursor to Power in command grid -> press A to open Power -> first stats page visible. Starts at default.state. Subgoals: cursor_on_power -> (termination) power_stats_first_page.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1AutoBattleTestTracker(SwordOfHope1TestTracker):
899class SwordOfHope1AutoBattleTestTracker(SwordOfHope1TestTracker):
900    """
901    Terminates when the agent navigates the cursor onto the AUTO command in
902    the battle command row. Tests command-row navigation in battle.
903    Starts at battle_example.state.
904    Subgoals: battle_active -> (termination) cursor_on_auto.
905    """
906
907    TERMINATION_TRUNCATION_METRIC = CursorOnAutoTerminateMetric
908    SUBGOAL_METRIC = make_subgoal_metric_class([BattleActiveSubGoal])

Terminates when the agent navigates the cursor onto the AUTO command in the battle command row. Tests command-row navigation in battle. Starts at battle_example.state. Subgoals: battle_active -> (termination) cursor_on_auto.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1ShopMenuOpenTestTracker(SwordOfHope1TestTracker):
911class SwordOfHope1ShopMenuOpenTestTracker(SwordOfHope1TestTracker):
912    """
913    Terminates when the shop's buy menu first opens. Shorter scope than
914    buy_item_test (which proceeds to purchase confirmation).
915    Starts at shop_forest.state.
916    Subgoals: dummy (single-step interaction).
917    """
918
919    TERMINATION_TRUNCATION_METRIC = ShopMenuOpenTerminateMetric
920    SUBGOAL_METRIC = DummySubGoalMetric

Terminates when the shop's buy menu first opens. Shorter scope than buy_item_test (which proceeds to purchase confirmation). Starts at shop_forest.state. Subgoals: dummy (single-step interaction).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1LookCommandSelectTestTracker(SwordOfHope1TestTracker):
923class SwordOfHope1LookCommandSelectTestTracker(SwordOfHope1TestTracker):
924    """
925    Terminates when the LOOK command is selected in the command grid.
926    Shorter scope than look_item_test (which proceeds to item discovery).
927    Starts at default.state.
928    Subgoals: dummy (single-step cursor + A).
929    """
930
931    TERMINATION_TRUNCATION_METRIC = LookSelectedTerminateMetric
932    SUBGOAL_METRIC = DummySubGoalMetric

Terminates when the LOOK command is selected in the command grid. Shorter scope than look_item_test (which proceeds to item discovery). Starts at default.state. Subgoals: dummy (single-step cursor + A).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1MenuOpenTestTracker(SwordOfHope1TestTracker):
935class SwordOfHope1MenuOpenTestTracker(SwordOfHope1TestTracker):
936    """
937    Terminates when the command menu first opens. Shorter scope than
938    menu_open_close_test (which proceeds to closing back to exploration).
939    Starts at default.state.
940    Subgoals: dummy (single-step menu trigger).
941    """
942
943    TERMINATION_TRUNCATION_METRIC = MenuOpenTerminateMetric
944    SUBGOAL_METRIC = DummySubGoalMetric

Terminates when the command menu first opens. Shorter scope than menu_open_close_test (which proceeds to closing back to exploration). Starts at default.state. Subgoals: dummy (single-step menu trigger).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1MagicMenuOpenTestTracker(SwordOfHope1TestTracker):
947class SwordOfHope1MagicMenuOpenTestTracker(SwordOfHope1TestTracker):
948    """
949    Terminates when the Magic spell list opens from the overworld. Shorter
950    scope than cast_teleport_test (which proceeds to casting Teleport).
951    Starts at default.state.
952    Subgoals: dummy (single navigation chain to open Magic submenu).
953    """
954
955    TERMINATION_TRUNCATION_METRIC = MagicMenuOpenTerminateMetric
956    SUBGOAL_METRIC = DummySubGoalMetric

Terminates when the Magic spell list opens from the overworld. Shorter scope than cast_teleport_test (which proceeds to casting Teleport). Starts at default.state. Subgoals: dummy (single navigation chain to open Magic submenu).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1DialogueInitiatedTestTracker(SwordOfHope1TestTracker):
959class SwordOfHope1DialogueInitiatedTestTracker(SwordOfHope1TestTracker):
960    """
961    Terminates the moment an NPC dialogue page first appears. Shorter scope
962    than talk_to_npc_test (which proceeds through one full dialogue advance).
963    Starts at default.state.
964    Subgoals: dummy (single talk action).
965    """
966
967    TERMINATION_TRUNCATION_METRIC = DialogueInitiatedTerminateMetric
968    SUBGOAL_METRIC = DummySubGoalMetric

Terminates the moment an NPC dialogue page first appears. Shorter scope than talk_to_npc_test (which proceeds through one full dialogue advance). Starts at default.state. Subgoals: dummy (single talk action).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CancelMagicMenuTestTracker(SwordOfHope1TestTracker):
981class SwordOfHope1CancelMagicMenuTestTracker(SwordOfHope1TestTracker):
982    """
983    Open the Magic submenu from exploration, then back out without casting.
984    Tests menu-cancel reasoning: agent must understand the B-button semantics
985    and recognize the difference between "open menu" and "commit to action".
986    Init: default.state. Subgoal: magic_menu_open -> (term) exploration_menu.
987    """
988
989    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
990    SUBGOAL_METRIC = make_subgoal_metric_class([MagicMenuOpenSubGoal])

Open the Magic submenu from exploration, then back out without casting. Tests menu-cancel reasoning: agent must understand the B-button semantics and recognize the difference between "open menu" and "commit to action". Init: default.state. Subgoal: magic_menu_open -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CancelPowerMenuTestTracker(SwordOfHope1TestTracker):
 993class SwordOfHope1CancelPowerMenuTestTracker(SwordOfHope1TestTracker):
 994    """
 995    Open the Power stats menu, view first stats page, then close back to
 996    exploration. Multi-step menu navigation with a deliberate exit.
 997    Init: default.state. Subgoal: power_stats_first_page -> (term) exploration_menu.
 998    """
 999
1000    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
1001    SUBGOAL_METRIC = make_subgoal_metric_class([PowerStatsFirstPageSubGoal])

Open the Power stats menu, view first stats page, then close back to exploration. Multi-step menu navigation with a deliberate exit. Init: default.state. Subgoal: power_stats_first_page -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CancelTeleportMenuTestTracker(SwordOfHope1TestTracker):
1004class SwordOfHope1CancelTeleportMenuTestTracker(SwordOfHope1TestTracker):
1005    """
1006    Open Magic -> Teleport -> destination list, then cancel back to
1007    exploration without teleporting. Tests cancellation of nested menus.
1008    Init: default.state. Subgoal: teleport_dest_cursor -> (term) exploration_menu.
1009    """
1010
1011    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
1012    SUBGOAL_METRIC = make_subgoal_metric_class([TeleportDestCursorSubGoal])

Open Magic -> Teleport -> destination list, then cancel back to exploration without teleporting. Tests cancellation of nested menus. Init: default.state. Subgoal: teleport_dest_cursor -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CancelShopMenuTestTracker(SwordOfHope1TestTracker):
1015class SwordOfHope1CancelShopMenuTestTracker(SwordOfHope1TestTracker):
1016    """
1017    Open the shop's buy menu, then exit without purchasing. Distinguishes
1018    "browse the inventory" from "commit to a purchase".
1019    Init: shop_forest.state. Subgoal: shop_menu_open -> (term) exploration_menu.
1020    """
1021
1022    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
1023    SUBGOAL_METRIC = make_subgoal_metric_class([ShopMenuOpenSubGoal])

Open the shop's buy menu, then exit without purchasing. Distinguishes "browse the inventory" from "commit to a purchase". Init: shop_forest.state. Subgoal: shop_menu_open -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CancelLookOptionsTestTracker(SwordOfHope1TestTracker):
1026class SwordOfHope1CancelLookOptionsTestTracker(SwordOfHope1TestTracker):
1027    """
1028    Select LOOK and view the target options, then back out without choosing.
1029    Pure inspection task: information-gather without committing.
1030    Init: default.state. Subgoal: look_target_options -> (term) exploration_menu.
1031    """
1032
1033    TERMINATION_TRUNCATION_METRIC = ExplorationMenuTerminateMetric
1034    SUBGOAL_METRIC = make_subgoal_metric_class([LookTargetOptionsSubGoal])

Select LOOK and view the target options, then back out without choosing. Pure inspection task: information-gather without committing. Init: default.state. Subgoal: look_target_options -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1BattleMagicCancelTestTracker(SwordOfHope1TestTracker):
1037class SwordOfHope1BattleMagicCancelTestTracker(SwordOfHope1TestTracker):
1038    """
1039    In battle, open the Magic submenu, then back out without casting. Battle
1040    contexts have a different default cursor; agent must learn the in-battle
1041    cancel pattern is symmetric to the overworld one.
1042    Init: battle_example.state. Subgoal: battle_magic_menu -> (term) battle_active.
1043    """
1044
1045    TERMINATION_TRUNCATION_METRIC = BattleActiveTerminateMetric
1046    SUBGOAL_METRIC = make_subgoal_metric_class([BattleMagicMenuSubGoal])

In battle, open the Magic submenu, then back out without casting. Battle contexts have a different default cursor; agent must learn the in-battle cancel pattern is symmetric to the overworld one. Init: battle_example.state. Subgoal: battle_magic_menu -> (term) battle_active.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CycleBackToLookTestTracker(SwordOfHope1TestTracker):
1049class SwordOfHope1CycleBackToLookTestTracker(SwordOfHope1TestTracker):
1050    """
1051    Starting from cursor on LOOK, the agent must cycle the cursor through the
1052    command grid all the way around (LOOK -> ... -> POWER -> wrap -> LOOK).
1053    Termination matches the original LOOK position but the SUBGOAL forces the
1054    agent to have actually visited POWER en route - otherwise it would just
1055    stay in place. Tests cyclic navigation understanding.
1056    Init: default.state. Subgoal: cursor_on_power -> (term) cursor_on_look.
1057    """
1058
1059    TERMINATION_TRUNCATION_METRIC = CursorOnLookTerminateMetric
1060    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnPowerSubGoal])

Starting from cursor on LOOK, the agent must cycle the cursor through the command grid all the way around (LOOK -> ... -> POWER -> wrap -> LOOK). Termination matches the original LOOK position but the SUBGOAL forces the agent to have actually visited POWER en route - otherwise it would just stay in place. Tests cyclic navigation understanding. Init: default.state. Subgoal: cursor_on_power -> (term) cursor_on_look.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CycleToPowerViaMagicTestTracker(SwordOfHope1TestTracker):
1063class SwordOfHope1CycleToPowerViaMagicTestTracker(SwordOfHope1TestTracker):
1064    """
1065    Navigate cursor to POWER, but only via MAGIC (constrained path). Forces the
1066    agent to take the lower-row route rather than the shortest L->R top-row
1067    route. Tests constrained-path reasoning.
1068    Init: default.state. Subgoal: cursor_on_magic -> (term) cursor_on_power.
1069    """
1070
1071    TERMINATION_TRUNCATION_METRIC = CursorOnPowerTerminateMetric
1072    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnMagicSubGoal])

Navigate cursor to POWER, but only via MAGIC (constrained path). Forces the agent to take the lower-row route rather than the shortest L->R top-row route. Tests constrained-path reasoning. Init: default.state. Subgoal: cursor_on_magic -> (term) cursor_on_power.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnFirebalTestTracker(SwordOfHope1TestTracker):
1075class SwordOfHope1CursorOnFirebalTestTracker(SwordOfHope1TestTracker):
1076    """
1077    In battle, open the Magic submenu and navigate the cursor to the FIREBAL
1078    spell specifically (not Firebal2, not other spells). Firebal is a
1079    battle-only spell in SoH1. Tests spell selection under list ambiguity.
1080    Init: pre_treant_engage.state (lvl 4 Theo with Firebal learned, in battle).
1081    Subgoal: battle_magic_menu -> (term) cursor_on_firebal.
1082    """
1083
1084    TERMINATION_TRUNCATION_METRIC = CursorOnFirebalTerminateMetric
1085    SUBGOAL_METRIC = make_subgoal_metric_class([BattleMagicMenuSubGoal])

In battle, open the Magic submenu and navigate the cursor to the FIREBAL spell specifically (not Firebal2, not other spells). Firebal is a battle-only spell in SoH1. Tests spell selection under list ambiguity. Init: pre_treant_engage.state (lvl 4 Theo with Firebal learned, in battle). Subgoal: battle_magic_menu -> (term) cursor_on_firebal.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnFirebal2TestTracker(SwordOfHope1TestTracker):
1088class SwordOfHope1CursorOnFirebal2TestTracker(SwordOfHope1TestTracker):
1089    """
1090    In battle, open the Magic submenu and cursor on FIREBAL2 specifically
1091    (the upgraded variant). Battle-only spell. Tests fine-grained spell
1092    distinction in the battle Magic list.
1093    Init: pre_treant_engage.state (verify Firebal2 is in spell list at lvl 4).
1094    Subgoal: battle_magic_menu -> (term) cursor_on_firebal2.
1095    """
1096
1097    TERMINATION_TRUNCATION_METRIC = CursorOnFirebal2TerminateMetric
1098    SUBGOAL_METRIC = make_subgoal_metric_class([BattleMagicMenuSubGoal])

In battle, open the Magic submenu and cursor on FIREBAL2 specifically (the upgraded variant). Battle-only spell. Tests fine-grained spell distinction in the battle Magic list. Init: pre_treant_engage.state (verify Firebal2 is in spell list at lvl 4). Subgoal: battle_magic_menu -> (term) cursor_on_firebal2.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnStripallTestTracker(SwordOfHope1TestTracker):
1101class SwordOfHope1CursorOnStripallTestTracker(SwordOfHope1TestTracker):
1102    """
1103    In battle, open the Magic submenu and cursor on STRIPALL specifically.
1104    Stripall is a battle-only debuff spell that strips enemy buffs/defense.
1105    Tests spell-purpose disambiguation: agent must distinguish damage spells
1106    (Firebal/Firebal2) from utility spells (Stripall) in the same list.
1107    Init: pre_treant_engage.state.
1108    Subgoal: battle_magic_menu -> (term) cursor_on_stripall.
1109    """
1110
1111    TERMINATION_TRUNCATION_METRIC = CursorOnStripallTerminateMetric
1112    SUBGOAL_METRIC = make_subgoal_metric_class([BattleMagicMenuSubGoal])

In battle, open the Magic submenu and cursor on STRIPALL specifically. Stripall is a battle-only debuff spell that strips enemy buffs/defense. Tests spell-purpose disambiguation: agent must distinguish damage spells (Firebal/Firebal2) from utility spells (Stripall) in the same list. Init: pre_treant_engage.state. Subgoal: battle_magic_menu -> (term) cursor_on_stripall.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnTeleportOldmanTestTracker(SwordOfHope1TestTracker):
1115class SwordOfHope1CursorOnTeleportOldmanTestTracker(SwordOfHope1TestTracker):
1116    """
1117    Cast Teleport and navigate the destination cursor onto OLD MAN'S HOUSE
1118    specifically (not Shaman's, not Forest). Tests destination disambiguation.
1119    Init: near_treant_postkill.state (multiple teleport destinations available).
1120    Subgoal: teleport_dest_cursor -> (term) cursor_on_teleport_oldman.
1121    """
1122
1123    TERMINATION_TRUNCATION_METRIC = CursorOnTeleportOldmanTerminateMetric
1124    SUBGOAL_METRIC = make_subgoal_metric_class([TeleportDestCursorSubGoal])

Cast Teleport and navigate the destination cursor onto OLD MAN'S HOUSE specifically (not Shaman's, not Forest). Tests destination disambiguation. Init: near_treant_postkill.state (multiple teleport destinations available). Subgoal: teleport_dest_cursor -> (term) cursor_on_teleport_oldman.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnHerbUseTestTracker(SwordOfHope1TestTracker):
1127class SwordOfHope1CursorOnHerbUseTestTracker(SwordOfHope1TestTracker):
1128    """
1129    Open the Use submenu and navigate cursor to HERB specifically (not Key M,
1130    not Scroll, not other items). Tests inventory item disambiguation.
1131    Init: mistress_backroom_access_collected.state (has Scroll + Herb).
1132    Subgoal: cursor_on_use -> (term) cursor_on_herb_use.
1133    """
1134
1135    TERMINATION_TRUNCATION_METRIC = CursorOnHerbUseTerminateMetric
1136    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnUseSubGoal])

Open the Use submenu and navigate cursor to HERB specifically (not Key M, not Scroll, not other items). Tests inventory item disambiguation. Init: mistress_backroom_access_collected.state (has Scroll + Herb). Subgoal: cursor_on_use -> (term) cursor_on_herb_use.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1CursorOnKeymUseTestTracker(SwordOfHope1TestTracker):
1139class SwordOfHope1CursorOnKeymUseTestTracker(SwordOfHope1TestTracker):
1140    """
1141    Open the Use submenu and navigate cursor to KEY M specifically. Tests
1142    inventory disambiguation in the at_martel_gate context where Key M is
1143    the correct (quest-required) item among other inventory entries.
1144    Init: at_martel_gate.state. Subgoal: cursor_on_use -> (term) cursor_on_keym_use.
1145    """
1146
1147    TERMINATION_TRUNCATION_METRIC = CursorOnKeymUseTerminateMetric
1148    SUBGOAL_METRIC = make_subgoal_metric_class([CursorOnUseSubGoal])

Open the Use submenu and navigate cursor to KEY M specifically. Tests inventory disambiguation in the at_martel_gate context where Key M is the correct (quest-required) item among other inventory entries. Init: at_martel_gate.state. Subgoal: cursor_on_use -> (term) cursor_on_keym_use.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1BattleStripallCancelTestTracker(SwordOfHope1TestTracker):
1151class SwordOfHope1BattleStripallCancelTestTracker(SwordOfHope1TestTracker):
1152    """
1153    In battle, navigate to STRIPALL in the Magic submenu (cursor on Stripall),
1154    then back out without casting it. Tests inspect-without-commit reasoning
1155    in a battle context with a non-default spell choice.
1156    Init: pre_treant_engage.state (battle active, Theo at lvl 4+).
1157    Subgoals (2):
1158        battle_magic_menu -> cursor_on_stripall -> (term) battle_active.
1159    """
1160
1161    TERMINATION_TRUNCATION_METRIC = BattleActiveTerminateMetric
1162    SUBGOAL_METRIC = make_subgoal_metric_class(
1163        [BattleMagicMenuSubGoal, CursorOnStripallSubGoal]
1164    )

In battle, navigate to STRIPALL in the Magic submenu (cursor on Stripall), then back out without casting it. Tests inspect-without-commit reasoning in a battle context with a non-default spell choice. Init: pre_treant_engage.state (battle active, Theo at lvl 4+). Subgoals (2): battle_magic_menu -> cursor_on_stripall -> (term) battle_active.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope1ViewPowerThenTeleportOldmanTestTracker(SwordOfHope1TestTracker):
1167class SwordOfHope1ViewPowerThenTeleportOldmanTestTracker(SwordOfHope1TestTracker):
1168    """
1169    Long-horizon composite reasoning task: agent must inspect player stats
1170    THEN travel via Teleport. Full chain:
1171      1. Navigate command cursor to POWER, press A to open Power stats
1172      2. Scroll through the Power stat slides to the LAST page
1173      3. Press B to close back to exploration
1174      4. Open Magic submenu -> select TELEPORT
1175      5. In destination list, navigate cursor to OLD MAN'S HOUSE
1176      6. Press A to confirm; agent lands at Old Man's House
1177    Termination: room_label shows oldman_house.
1178    Init: lvl5_overworld.state (player at lvl 5+, Teleport unlocked, Old Man's
1179    House available as a teleport destination).
1180    Subgoals (3, in order):
1181        cursor_on_power -> power_stats_last_page -> cursor_on_teleport_oldman
1182        -> (term) oldman_house.
1183    Tests: long-horizon planning with menu-inspect-then-act reasoning across
1184    three distinct UI contexts (command grid, Power stats menu, Teleport
1185    destination list) before the agent commits to the travel action.
1186    """
1187
1188    TERMINATION_TRUNCATION_METRIC = OldmanHouseTerminateMetric
1189    SUBGOAL_METRIC = make_subgoal_metric_class(
1190        [
1191            CursorOnPowerSubGoal,
1192            PowerStatsLastPageSubGoal,
1193            CursorOnTeleportOldmanSubGoal,
1194        ]
1195    )

Long-horizon composite reasoning task: agent must inspect player stats THEN travel via Teleport. Full chain:

  1. Navigate command cursor to POWER, press A to open Power stats
  2. Scroll through the Power stat slides to the LAST page
  3. Press B to close back to exploration
  4. Open Magic submenu -> select TELEPORT
  5. In destination list, navigate cursor to OLD MAN'S HOUSE
  6. Press A to confirm; agent lands at Old Man's House Termination: room_label shows oldman_house. Init: lvl5_overworld.state (player at lvl 5+, Teleport unlocked, Old Man's House available as a teleport destination). Subgoals (3, in order): cursor_on_power -> power_stats_last_page -> cursor_on_teleport_oldman -> (term) oldman_house. Tests: long-horizon planning with menu-inspect-then-act reasoning across three distinct UI contexts (command grid, Power stats menu, Teleport destination list) before the agent commits to the travel action.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CancelMagicMenuTestTracker(SwordOfHope2TestTracker):
1203class SwordOfHope2CancelMagicMenuTestTracker(SwordOfHope2TestTracker):
1204    """
1205    Open the Magic submenu from exploration, then back out without casting.
1206    Mirror of SoH1 variant. Tests menu-cancel reasoning.
1207    Init: lvl2_overworld.state (Theo has Motion spell available).
1208    Subgoal: magic_menu_open -> (term) exploration_menu.
1209    """
1210
1211    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1212    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2MagicMenuOpenSubGoal])

Open the Magic submenu from exploration, then back out without casting. Mirror of SoH1 variant. Tests menu-cancel reasoning. Init: lvl2_overworld.state (Theo has Motion spell available). Subgoal: magic_menu_open -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CancelItemMenuTestTracker(SwordOfHope2TestTracker):
1215class SwordOfHope2CancelItemMenuTestTracker(SwordOfHope2TestTracker):
1216    """
1217    Open the Item submenu (inventory list), then back out without using
1218    anything. Tests inventory-browse vs commit-to-use distinction.
1219    Init: hit_tree_example.state (Wheat in inventory).
1220    Subgoal: item_menu_open -> (term) exploration_menu.
1221    """
1222
1223    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1224    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ItemMenuOpenSubGoal])

Open the Item submenu (inventory list), then back out without using anything. Tests inventory-browse vs commit-to-use distinction. Init: hit_tree_example.state (Wheat in inventory). Subgoal: item_menu_open -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CancelShopMenuTestTracker(SwordOfHope2TestTracker):
1227class SwordOfHope2CancelShopMenuTestTracker(SwordOfHope2TestTracker):
1228    """
1229    Open a shop's buy menu, then exit without purchasing.
1230    Init: shop_example.state. Subgoal: shop_menu_open -> (term) exploration_menu.
1231    """
1232
1233    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1234    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ShopMenuOpenSubGoal])

Open a shop's buy menu, then exit without purchasing. Init: shop_example.state. Subgoal: shop_menu_open -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CancelWeaponsShopBuyTestTracker(SwordOfHope2TestTracker):
1237class SwordOfHope2CancelWeaponsShopBuyTestTracker(SwordOfHope2TestTracker):
1238    """
1239    Navigate into the weapons shop BUY item list, then exit without buying.
1240    Init: weapons_shop_example.state.
1241    Subgoal: weapons_shop_menu_open -> (term) exploration_menu.
1242    """
1243
1244    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1245    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2WeaponsShopMenuOpenSubGoal])

Navigate into the weapons shop BUY item list, then exit without buying. Init: weapons_shop_example.state. Subgoal: weapons_shop_menu_open -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CancelLookShopkeeperTestTracker(SwordOfHope2TestTracker):
1248class SwordOfHope2CancelLookShopkeeperTestTracker(SwordOfHope2TestTracker):
1249    """
1250    Look at the weapons-shop shopkeeper, then back out without engaging.
1251    Tests Look-without-interact distinction.
1252    Init: weapons_shop_example.state.
1253    Subgoal: look_shopkeeper -> (term) exploration_menu.
1254    """
1255
1256    TERMINATION_TRUNCATION_METRIC = SoH2ExplorationMenuTerminateMetric
1257    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2LookShopkeeperSubGoal])

Look at the weapons-shop shopkeeper, then back out without engaging. Tests Look-without-interact distinction. Init: weapons_shop_example.state. Subgoal: look_shopkeeper -> (term) exploration_menu.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2AutoToClashBattleTestTracker(SwordOfHope2TestTracker):
1260class SwordOfHope2AutoToClashBattleTestTracker(SwordOfHope2TestTracker):
1261    """
1262    Starting in battle, navigate cursor to AUTO first, then move it back to
1263    CLASH (reverse selection). Tests reversible cursor reasoning in battle.
1264    Init: battle_example.state.
1265    Subgoal: cursor_on_auto -> (term) cursor_on_clash.
1266    """
1267
1268    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnClashTerminateMetric
1269    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnAutoSubGoal])

Starting in battle, navigate cursor to AUTO first, then move it back to CLASH (reverse selection). Tests reversible cursor reasoning in battle. Init: battle_example.state. Subgoal: cursor_on_auto -> (term) cursor_on_clash.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2ClashToAutoBattleTestTracker(SwordOfHope2TestTracker):
1272class SwordOfHope2ClashToAutoBattleTestTracker(SwordOfHope2TestTracker):
1273    """
1274    Starting in battle, cursor on CLASH (default), navigate to AUTO.
1275    Mirror of the AUTO->CLASH variant. Tests reverse-direction cursor.
1276    Init: battle_example.state.
1277    Subgoal: cursor_on_clash -> (term) cursor_on_auto.
1278    """
1279
1280    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnAutoTerminateMetric
1281    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnClashSubGoal])

Starting in battle, cursor on CLASH (default), navigate to AUTO. Mirror of the AUTO->CLASH variant. Tests reverse-direction cursor. Init: battle_example.state. Subgoal: cursor_on_clash -> (term) cursor_on_auto.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnMotionTestTracker(SwordOfHope2TestTracker):
1284class SwordOfHope2CursorOnMotionTestTracker(SwordOfHope2TestTracker):
1285    """
1286    Open the Magic submenu and navigate the cursor to MOTION (the lvl-2
1287    overworld spell). SoH2's party system requires an extra step compared to
1288    SoH1: agent must first pick the party member (Theo) before their spell
1289    list is shown.
1290    Init: lvl2_overworld.state.
1291    Subgoals (2, in order):
1292        magic_menu_open (party member list visible)
1293        -> cursor_on_theo (cursor on Theo in party list, about to confirm)
1294        -> (term) cursor_on_motion (cursor on Motion in Theo's spell list).
1295    """
1296
1297    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnMotionTerminateMetric
1298    SUBGOAL_METRIC = make_subgoal_metric_class(
1299        [SoH2MagicMenuOpenSubGoal, SoH2CursorOnTheoSubGoal]
1300    )

Open the Magic submenu and navigate the cursor to MOTION (the lvl-2 overworld spell). SoH2's party system requires an extra step compared to SoH1: agent must first pick the party member (Theo) before their spell list is shown. Init: lvl2_overworld.state. Subgoals (2, in order): magic_menu_open (party member list visible) -> cursor_on_theo (cursor on Theo in party list, about to confirm) -> (term) cursor_on_motion (cursor on Motion in Theo's spell list).

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnShopFirstItemTestTracker(SwordOfHope2TestTracker):
1303class SwordOfHope2CursorOnShopFirstItemTestTracker(SwordOfHope2TestTracker):
1304    """
1305    In a generic shop's buy list, cursor on the FIRST item entry. Tests "go
1306    to top of list" reasoning - distinguished from "cursor on Wheat" which is
1307    a different shop layout.
1308    Init: shop_example.state.
1309    Subgoal: shop_menu_open -> (term) cursor_on_shop_first_item.
1310    """
1311
1312    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnShopFirstItemTerminateMetric
1313    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2ShopMenuOpenSubGoal])

In a generic shop's buy list, cursor on the FIRST item entry. Tests "go to top of list" reasoning - distinguished from "cursor on Wheat" which is a different shop layout. Init: shop_example.state. Subgoal: shop_menu_open -> (term) cursor_on_shop_first_item.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnShopThirdItemTestTracker(SwordOfHope2TestTracker):
1316class SwordOfHope2CursorOnShopThirdItemTestTracker(SwordOfHope2TestTracker):
1317    """
1318    Same shop as cursor_on_shop_first_item_test, but cursor on the THIRD item
1319    entry. Tests bounded list navigation — agent must traverse from the
1320    default cursor position (first item) down to the third.
1321    Init: shop_example.state.
1322    Subgoals (2): shop_menu_open -> cursor_on_shop_first_item ->
1323        (term) cursor_on_shop_third_item.
1324    """
1325
1326    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnShopThirdItemTerminateMetric
1327    SUBGOAL_METRIC = make_subgoal_metric_class(
1328        [SoH2ShopMenuOpenSubGoal, SoH2CursorOnShopFirstItemSubGoal]
1329    )

Same shop as cursor_on_shop_first_item_test, but cursor on the THIRD item entry. Tests bounded list navigation — agent must traverse from the default cursor position (first item) down to the third. Init: shop_example.state. Subgoals (2): shop_menu_open -> cursor_on_shop_first_item -> (term) cursor_on_shop_third_item.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnFirstWeaponTestTracker(SwordOfHope2TestTracker):
1332class SwordOfHope2CursorOnFirstWeaponTestTracker(SwordOfHope2TestTracker):
1333    """
1334    In the weapons shop, cursor on the FIRST weapon entry. Distinguished from
1335    cursor_on_cpr_sword_test (3rd entry) - tests "top of list" navigation.
1336    Init: weapons_shop_example.state.
1337    Subgoal: weapons_shop_menu_open -> (term) cursor_on_first_weapon.
1338    """
1339
1340    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnFirstWeaponTerminateMetric
1341    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2WeaponsShopMenuOpenSubGoal])

In the weapons shop, cursor on the FIRST weapon entry. Distinguished from cursor_on_cpr_sword_test (3rd entry) - tests "top of list" navigation. Init: weapons_shop_example.state. Subgoal: weapons_shop_menu_open -> (term) cursor_on_first_weapon.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnSecondWeaponTestTracker(SwordOfHope2TestTracker):
1344class SwordOfHope2CursorOnSecondWeaponTestTracker(SwordOfHope2TestTracker):
1345    """
1346    Weapons shop, cursor on the SECOND weapon entry. Tests single-step
1347    navigation from the first item position.
1348    Init: weapons_shop_example.state.
1349    Subgoals (2): weapons_shop_menu_open -> cursor_on_first_weapon ->
1350        (term) cursor_on_second_weapon.
1351    """
1352
1353    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnSecondWeaponTerminateMetric
1354    SUBGOAL_METRIC = make_subgoal_metric_class(
1355        [SoH2WeaponsShopMenuOpenSubGoal, SoH2CursorOnFirstWeaponSubGoal]
1356    )

Weapons shop, cursor on the SECOND weapon entry. Tests single-step navigation from the first item position. Init: weapons_shop_example.state. Subgoals (2): weapons_shop_menu_open -> cursor_on_first_weapon -> (term) cursor_on_second_weapon.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2CursorOnThirdWeaponTestTracker(SwordOfHope2TestTracker):
1359class SwordOfHope2CursorOnThirdWeaponTestTracker(SwordOfHope2TestTracker):
1360    """
1361    Weapons shop, cursor on the THIRD weapon entry (CPR Sword in current
1362    shop layout). Distinguished from cursor_on_cpr_sword_test by framing:
1363    this tests bounded-list navigation by position, not by name.
1364    Init: weapons_shop_example.state.
1365    Subgoals (3): weapons_shop_menu_open -> cursor_on_first_weapon ->
1366        cursor_on_second_weapon -> (term) cursor_on_third_weapon.
1367    """
1368
1369    TERMINATION_TRUNCATION_METRIC = SoH2CursorOnThirdWeaponTerminateMetric
1370    SUBGOAL_METRIC = make_subgoal_metric_class(
1371        [
1372            SoH2WeaponsShopMenuOpenSubGoal,
1373            SoH2CursorOnFirstWeaponSubGoal,
1374            SoH2CursorOnSecondWeaponSubGoal,
1375        ]
1376    )

Weapons shop, cursor on the THIRD weapon entry (CPR Sword in current shop layout). Distinguished from cursor_on_cpr_sword_test by framing: this tests bounded-list navigation by position, not by name. Init: weapons_shop_example.state. Subgoals (3): weapons_shop_menu_open -> cursor_on_first_weapon -> cursor_on_second_weapon -> (term) cursor_on_third_weapon.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2LookTreeTargetTestTracker(SwordOfHope2TestTracker):
1379class SwordOfHope2LookTreeTargetTestTracker(SwordOfHope2TestTracker):
1380    """
1381    Use LOOK on a grass tile (not the shopkeeper, not the tree). Tests
1382    target disambiguation in the Look menu where multiple visible targets
1383    are available.
1384    Init: hit_tree_example.state (grass tiles nearby).
1385    Subgoal: cursor_on_look -> (term) look_tree_target.
1386    """
1387
1388    TERMINATION_TRUNCATION_METRIC = SoH2LookTreeTargetTerminateMetric
1389    SUBGOAL_METRIC = make_subgoal_metric_class([SoH2CursorOnLookSubGoal])

Use LOOK on a grass tile (not the shopkeeper, not the tree). Tests target disambiguation in the Look menu where multiple visible targets are available. Init: hit_tree_example.state (grass tiles nearby). Subgoal: cursor_on_look -> (term) look_tree_target.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.

class SwordOfHope2ViewPowerThenCastMotionTestTracker(SwordOfHope2TestTracker):
1392class SwordOfHope2ViewPowerThenCastMotionTestTracker(SwordOfHope2TestTracker):
1393    """
1394    Long-horizon composite reasoning task (SoH2 mirror of SoH1's
1395    view_power_then_teleport_oldman_test):
1396      1. Navigate command cursor to POWER, press A
1397      2. Scroll through Power stats first page to the exp/level page
1398      3. Press B to close Power back to exploration
1399      4. Open Magic submenu, choose Theo, choose Motion, confirm cast
1400    Termination: motion_result (Motion cast confirmation dialogue).
1401    Init: lvl2_overworld.state.
1402    Subgoals (3, in order):
1403        cursor_on_power -> power_stats_first_page -> power_stats_exp_page
1404        -> (term) motion_result.
1405    Tests: inspect-then-act long-horizon planning across Power menu and
1406    party-magic chain.
1407    """
1408
1409    TERMINATION_TRUNCATION_METRIC = SoH2MotionResultTerminateMetric
1410    SUBGOAL_METRIC = make_subgoal_metric_class(
1411        [
1412            SoH2CursorOnPowerSubGoal,
1413            SoH2PowerStatsFirstPageSubGoal,
1414            SoH2PowerStatsExpPageSubGoal,
1415        ]
1416    )

Long-horizon composite reasoning task (SoH2 mirror of SoH1's view_power_then_teleport_oldman_test):

  1. Navigate command cursor to POWER, press A
  2. Scroll through Power stats first page to the exp/level page
  3. Press B to close Power back to exploration
  4. Open Magic submenu, choose Theo, choose Motion, confirm cast Termination: motion_result (Motion cast confirmation dialogue). Init: lvl2_overworld.state. Subgoals (3, in order): cursor_on_power -> power_stats_first_page -> power_stats_exp_page -> (term) motion_result. Tests: inspect-then-act long-horizon planning across Power menu and party-magic chain.

The TerminationTruncationMetric class to use for tracking termination and truncation. If None, no such metric will be tracked.

SUBGOAL_METRIC = <class 'gameboy_worlds.emulation.tracker.make_subgoal_metric_class.<locals>.CustomSubGoalMetric'>

The SubGoalMetric class to use for tracking subgoal progress. If None, no such metric will be tracked.