diff --git a/Routes/Gold_Silver_Route.py b/Routes/Gold_Silver_Route.py index 9f4660e..acd5e36 100644 --- a/Routes/Gold_Silver_Route.py +++ b/Routes/Gold_Silver_Route.py @@ -1,6 +1,8 @@ import networkx as nx from networkx import Graph +from Routes.pokemon_game_desc import PokemonGameDesc + NEW_BARK_TOWN = 'New Bark Town' CHERRYGROVE_CITY = 'Cherrygrove City' VIOLET_CITY = 'Violet City' @@ -44,6 +46,7 @@ CINNABAR_ISLAND = 'Cinnabar Island' MT_SILVER = 'Mt. Silver' SAFARI_ZONE = 'Safari Zone' TOHJO_FALLS = 'Tohjo Falls' +POWER_PLANT = 'Power Plant' CUT = 'Cut' SURF = 'Surf' @@ -62,13 +65,46 @@ MINERAL_BADGE = 'Mineral Badge' GLACIER_BADGE = 'Glacier Badge' RISING_BADGE = 'Rising Badge' +BOULDER_BADGE = 'Boulder Badge' +CASCADE_BADGE = 'Cascade Badge' +THUNDER_BADGE = 'Thunder Badge' +RAINBOW_BADGE = 'Rainbow Badge' +MARSH_BADGE = 'Marsh Badge' +SOUL_BADGE = 'Soul Badge' +VOLCANO_BADGE = 'Volcano Badge' +EARTH_BADGE = 'Earth Badge' + SQUIRTBOTTLE = 'Squirt bottle' MEDICINE = 'Medicine' CATCH_RED_GYRADOS = 'Catch Red Gryados' ROCKET_DEAFEATED = 'Rocket Defeated' -OBTAIN_WING = 'Obtain Wing' +PKMN_WING = 'Gold Silver Wing' JOHTO_CHAMPION = 'Johto Champion' S_S_TICKET = 'S.S. Ticket' +WOKE_SNORLAX = 'Woke Snorlax' +EXPN_CARD = 'Expn card' +POWER_RESTORED = 'Power restored' +MACHINE_PART = 'Machine Part' +CLEFAIRY_DOLL = 'Clefairy Doll' +RAIL_PASS = 'Rail Pass' +MISTY_FOUND = 'Misty Found' +FLUTE_CHANNEL = 'Flute Channel' + +FLY = 'Fly' + +FLY_OUT_OF_BATTLE = 'Fly out of battle' + +def get_gold_silver_desc() -> PokemonGameDesc: + desc: PokemonGameDesc = PokemonGameDesc() + desc.graph = get_gold_silver_route() + desc.game_name = "Gold/Silver" + desc.towns_and_cities = [NEW_BARK_TOWN, CHERRYGROVE_CITY, VIOLET_CITY, AZALEA_TOWN, GOLDENROD_CITY, ECRUTEAK_CITY, OLIVINE_CITY, CIANWOOD_CITY, MAHOGANY_TOWN, BLACKTHORN_CITY, PALLET_TOWN, VIRIDIAN_CITY, PEWTER_CITY, CERULEAN_CITY, SAFFRON_CITY, CELADON_CITY, VERMILION_CITY, FUCHSIA_CITY, CINNABAR_ISLAND] + desc.badges = [ZEPHYR_BADGE, HIVE_BADGE, PLAIN_BADGE, FOG_BADGE, STORM_BADGE, MINERAL_BADGE, GLACIER_BADGE, RISING_BADGE, BOULDER_BADGE, CASCADE_BADGE, THUNDER_BADGE, RAINBOW_BADGE, MARSH_BADGE, SOUL_BADGE, VOLCANO_BADGE, EARTH_BADGE] + desc.hms = [CUT, SURF, FLASH, STRENGTH, FLY, WATERFALL, WHIRLPOOL] + desc.starting_town = NEW_BARK_TOWN + desc.end_goal = MT_SILVER + + return desc def get_gold_silver_route() -> Graph: G = nx.Graph() @@ -176,6 +212,10 @@ def get_gold_silver_route() -> Graph: G.add_edge(VICTORY_ROAD, INDIGO_PLATEAU, condition=None) G.add_edge('Route 22', 'Route 27', condition=None) + G.add_edge(SS_AQUA, VERMILION_CITY, condition=None) + G.add_edge(SAFFRON_CITY, GOLDENROD_CITY, condition=[POWER_RESTORED, RAIL_PASS]) + G.add_edge(DIGLETTS_CAVE, 'Route 11', condition=[WOKE_SNORLAX]) + G.nodes[NEW_BARK_TOWN]['grants_conditions'] = [ {'condition': S_S_TICKET, 'required_conditions': [JOHTO_CHAMPION]} ] @@ -227,5 +267,40 @@ def get_gold_silver_route() -> Graph: G.nodes[INDIGO_PLATEAU]['grants_conditions'] = [ {'condition': JOHTO_CHAMPION, 'required_conditions': []} ] + G.nodes[VERMILION_CITY]['grants_conditions'] = [ + {'condition': THUNDER_BADGE, 'required_conditions': []}, + {'condition': FLUTE_CHANNEL, 'required_conditions': [EXPN_CARD]}, + {'condition': CLEFAIRY_DOLL, 'required_conditions': [POWER_RESTORED]}, + ] + G.nodes[SAFFRON_CITY]['grants_conditions'] = [ + {'condition': MARSH_BADGE, 'required_conditions': []}, + {'condition': RAIL_PASS, 'required_conditions': [CLEFAIRY_DOLL]}, + ] + G.nodes[LAVENDER_TOWN]['grants_conditions'] = [ + {'condition': EXPN_CARD, 'required_conditions': [POWER_RESTORED]} + ] + G.nodes[POWER_PLANT]['grants_conditions'] = [ + {'condition': POWER_RESTORED, 'required_conditions': [MACHINE_PART]} + ] + G.nodes[CERULEAN_CITY]['grants_conditions'] = [ + {'condition': CASCADE_BADGE, 'required_conditions': [MISTY_FOUND]} + ] + G.nodes['Route 25']['grants_conditions'] = [ + {'condition': MISTY_FOUND, 'required_conditions': []} + ] + G.nodes[CELADON_CITY]['grants_conditions'] = [ + {'condition': RAINBOW_BADGE, 'required_conditions': []} + ] + G.nodes[FUCHSIA_CITY]['grants_conditions'] = [ + {'condition': FOG_BADGE, 'required_conditions': []} + ] + G.nodes['Route 11']['grants_conditions'] = [ + {'condition': WOKE_SNORLAX, 'required_conditions': [FLUTE_CHANNEL]} + ] + G.nodes[PEWTER_CITY]['grants_conditions'] = [ + {'condition': BOULDER_BADGE, 'required_conditions': []}, + {'condition': PKMN_WING, 'required_conditions': []}, + + ] return G \ No newline at end of file diff --git a/downward b/downward new file mode 160000 index 0000000..c7d6a4d --- /dev/null +++ b/downward @@ -0,0 +1 @@ +Subproject commit c7d6a4d87a10a4c2857285c3b49a14e8d18717a2 diff --git a/red_blue_goal_path.py b/red_blue_goal_path.py index ae03c5a..8c23b8e 100644 --- a/red_blue_goal_path.py +++ b/red_blue_goal_path.py @@ -4,7 +4,7 @@ from pyvis.network import Network import heapq from copy import deepcopy -from Routes.Gold_Silver_Route import CATCH_RED_GYRADOS, FOG_BADGE, GLACIER_BADGE, HIVE_BADGE, JOHTO_CHAMPION, MEDICINE, MINERAL_BADGE, NEW_BARK_TOWN, PLAIN_BADGE, RISING_BADGE, ROCK_SMASH, ROCKET_DEAFEATED, SS_AQUA, ZEPHYR_BADGE, get_gold_silver_route +from Routes.Gold_Silver_Route import CATCH_RED_GYRADOS, FOG_BADGE, GLACIER_BADGE, HIVE_BADGE, JOHTO_CHAMPION, MEDICINE, MINERAL_BADGE, NEW_BARK_TOWN, PLAIN_BADGE, RISING_BADGE, ROCK_SMASH, ROCKET_DEAFEATED, SS_AQUA, ZEPHYR_BADGE, get_gold_silver_desc, get_gold_silver_route from Routes.Red_Blue_Route import ARCTICUNO, BOULDER_BADGE, CASCADE_BADGE, CERULEAN_CAVE, CHAMPION, CUT, FLASH, GIOVANNI_FIGHT, MARSH_BADGE, MEWTWO, MOLTRES, PALLET_TOWN, POKE_FLUTE, QUENCHED_THURST, RAINBOW_BADGE, SILPH_SCOPE, SOUL_BADGE, SS_ANNE_TICKET, THUNDER_BADGE, VOLCANO_BADGE, ZAPDOS, get_red_blue_desc, get_red_blue_route from convert_to_pddl import generate_pddl_domain, generate_pddl_problem @@ -119,7 +119,7 @@ def can_traverse(edge_attrs, player_state: PlayerState): # Example usage if __name__ == "__main__": - + """ G = get_red_blue_route() # Define the ordered goals that the player must acquire @@ -178,9 +178,10 @@ if __name__ == "__main__": print("Optimal Path:", " -> ".join(optimal_path)) else: print("No path found to fulfill all goals.") + """ generate_pddl_domain() - red_blue = get_red_blue_desc() + gold_silver = get_gold_silver_desc() generate_pddl_problem(red_blue)