From 377deb5bb4a7662851a383426813e123c2d362c8 Mon Sep 17 00:00:00 2001 From: Quildra Date: Mon, 25 Nov 2024 22:21:07 +0000 Subject: [PATCH] - Bit more data on conditions --- Pokemon_Red_Route_Planner.py | 189 +++++++++++++++++++++++++++-------- 1 file changed, 149 insertions(+), 40 deletions(-) diff --git a/Pokemon_Red_Route_Planner.py b/Pokemon_Red_Route_Planner.py index cb043d9..7890360 100644 --- a/Pokemon_Red_Route_Planner.py +++ b/Pokemon_Red_Route_Planner.py @@ -1,30 +1,132 @@ import networkx as nx from pyvis.network import Network +PALLET_TOWN = 'Pallet Town' +VIRIDIAN_CITY = 'Viridian City' +VIRIDIAN_FOREST = 'Viridian Forest' +PEWTER_CITY = 'Pewter City' +MT_MOON = 'Mt. Moon' +CERULEAN_CITY = 'Cerulean City' +POWER_PLANT = 'Power Plant' +SAFFRON_CITY = 'Saffron City' +CELADON_CITY = 'Celadon City' +CERULEAN_CAVE = 'Cerulean Cave' +VERMILLION_CITY = 'Vermillion City' +BILLS_HOUSE = 'Bill\'s House' +FUCHSIA_CITY = 'Fuchsia City' +SS_ANNE = 'S.S. Anne' +CINNABAR_ISLAND = 'Cinnabar Island' +SEAFOAM_ISLANDS ='Seafoam Islands' +VICTORY_ROAD = 'Victory Road' +INDIGO_PLATEAU = 'Indigo Plateau' +ROCK_TUNNEL = 'Rock Tunnel' +UNDERGROUND_PATH = 'Underground Path' +UNDERGROUND_PASSAGE = 'Underground Passage' +DIGLETT_CAVE = 'Diglett Cave' +POKEMON_TOWER = 'Pokemon Tower' +LAVENDER_TOWN = 'Lavender Town' + +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' + +BIKE = 'Bike' +BIKE_VOUCHER = 'Bike Voucer' +SS_ANNE_TICKET = 'S.S. Anne Ticket' +QUENCHED_THURST = 'Quenched Thrust' +POKE_FLUTE = 'Poke Flute' +SILPH_SCOPE = 'Silph Scope' +GIOVANNI_FIGHT = 'Giovanni Fight' +CHAMPION = 'Champion' + +CUT = 'Cut' +SURF = 'Surf' +FLASH = 'Flash' +STRENGTH = 'Strength' + def main(): G = nx.DiGraph() for i in range(1,25): G.add_node(f'Route {i}', node_type='route') - G.add_node('Pallet Town', node_type='location') - G.add_node('Viridian City', node_type='location') - G.add_node('Viridian Forest', node_type='location') - G.add_node('Pewter City', node_type='location') - G.add_node('Mt. Moon', node_type='location') - G.add_node('Cerulean City', node_type='location') - G.add_node('Power Plant', node_type='location') - G.add_node('Saffron City', node_type='location') - G.add_node('Celadon City', node_type='location') - G.add_node('Cerulean Cave', node_type='location') - G.add_node('Vermillion City', node_type='location') - G.add_node('Fuchsia City', node_type='location') - G.add_node('Cinnabar Island', node_type='location') - G.add_node('Seafoam Islands', node_type='location') - G.add_node('Victory Road', node_type='location') - G.add_node('Indigo Plateau', node_type='location') - G.add_node('Rock Tunnel', node_type='location') - G.add_node('Underground Path', node_type='location') + G.nodes['Route 2']['grants_conditions'] = [ + {'condition': FLASH, 'required_conditions': [CUT]} + ] + + G.add_node(PALLET_TOWN, node_type='location') + G.add_node(VIRIDIAN_CITY, node_type='location') + G.nodes[VIRIDIAN_CITY]['grants_conditions'] = [ + {'condition': EARTH_BADGE, 'required_conditions': [GIOVANNI_FIGHT]} + ] + G.add_node(VIRIDIAN_FOREST, node_type='location') + G.add_node(PEWTER_CITY, node_type='location') + G.nodes[PEWTER_CITY]['grants_conditions'] = [ + {'condition': BOULDER_BADGE, 'required_conditions': []} + ] + G.add_node(MT_MOON, node_type='location') + G.add_node(CERULEAN_CITY, node_type='location') + G.nodes[CERULEAN_CITY]['grants_conditions'] = [ + {'condition': CASCADE_BADGE, 'required_conditions': []}, + {'condition': BIKE, 'required_conditions': [BIKE_VOUCHER]}, + ] + G.add_node(BILLS_HOUSE, node_type='location') + G.nodes[BILLS_HOUSE]['grants_conditions'] = [ + {'condition': SS_ANNE_TICKET, 'required_conditions': []} + ] + G.add_node(POWER_PLANT, node_type='location') + G.add_node(SAFFRON_CITY, node_type='location') + G.nodes[SAFFRON_CITY]['grants_conditions'] = [ + {'condition': MARSH_BADGE, 'required_conditions': []}, + {'condition': GIOVANNI_FIGHT, 'required_conditions': []}, + ] + G.add_node(SS_ANNE, node_type='location') + G.nodes[SS_ANNE]['grants_conditions'] = [ + {'condition': CUT, 'required_conditions': []} + ] + G.add_node(CERULEAN_CAVE, node_type='location') + G.add_node(VERMILLION_CITY, node_type='location') + G.nodes[VERMILLION_CITY]['grants_conditions'] = [ + {'condition': BIKE_VOUCHER, 'required_conditions': []}, + {'condition': THUNDER_BADGE, 'required_conditions': [CUT]} + ] + G.add_node(CELADON_CITY, node_type='location') + G.nodes[CELADON_CITY]['grants_conditions'] = [ + {'condition': QUENCHED_THURST, 'required_conditions': []}, + {'condition': RAINBOW_BADGE, 'required_conditions': []}, + {'condition': SILPH_SCOPE, 'required_conditions': []} + ] + G.add_node(FUCHSIA_CITY, node_type='location') + G.nodes[FUCHSIA_CITY]['grants_conditions'] = [ + {'condition': SURF, 'required_conditions': []}, + {'condition': STRENGTH, 'required_conditions': []}, + {'condition': SOUL_BADGE, 'required_conditions': []}, + ] + G.add_node(CINNABAR_ISLAND, node_type='location') + G.nodes[SS_ANNE]['grants_conditions'] = [ + {'condition': VOLCANO_BADGE, 'required_conditions': []} + ] + G.add_node(SEAFOAM_ISLANDS, node_type='location') + G.add_node(VICTORY_ROAD, node_type='location') + G.add_node(INDIGO_PLATEAU, node_type='location') + G.nodes[INDIGO_PLATEAU]['grants_conditions'] = [ + {'condition': CHAMPION, 'required_conditions': []} + ] + G.add_node(ROCK_TUNNEL, node_type='location') + G.add_node(UNDERGROUND_PATH, node_type='location') + G.add_node(DIGLETT_CAVE, node_type='location') + G.add_node(POKEMON_TOWER, node_type='location') + G.nodes[POKEMON_TOWER]['grants_conditions'] = [ + {'condition': POKE_FLUTE, 'required_conditions': []} + ] + G.add_node(LAVENDER_TOWN, node_type='location') + G.add_node(UNDERGROUND_PASSAGE, node_type='location') + G.add_edge('Pallet Town', 'Route 1', condition=None) G.add_edge('Pallet Town', 'Route 21', condition=None) @@ -37,44 +139,51 @@ def main(): G.add_edge('Mt. Moon', 'Route 4', condition=None) G.add_edge('Route 4', 'Cerulean City', condition=None) G.add_edge('Cerulean City', 'Route 24', condition=None) - G.add_edge('Cerulean City', 'Route 9', condition=None) + G.add_edge('Cerulean City', 'Route 9', condition=[CUT]) G.add_edge('Cerulean City', 'Route 5', condition=None) - G.add_edge('Route 5', 'Saffron City', condition=None) - G.add_edge('Saffron City', 'Route 6', condition=None) - G.add_edge('Saffron City', 'Route 7', condition=None) - G.add_edge('Saffron City', 'Route 8', condition=None) + G.add_edge('Route 5', 'Saffron City', condition=[QUENCHED_THURST]) + G.add_edge('Saffron City', 'Route 6', condition=[QUENCHED_THURST]) + G.add_edge('Saffron City', 'Route 7', condition=[QUENCHED_THURST]) + G.add_edge('Saffron City', 'Route 8', condition=[QUENCHED_THURST]) G.add_edge('Route 6', 'Vermillion City', condition=None) G.add_edge('Vermillion City', 'Route 11', condition=None) - G.add_edge('Route 11', 'Route 12', condition=None) + G.add_edge('Vermillion City', SS_ANNE, condition=[SS_ANNE_TICKET]) + G.add_edge('Route 11', 'Route 12', condition=[POKE_FLUTE]) + G.add_edge('Route 11', DIGLETT_CAVE, condition=None) + G.add_edge('Route 2', DIGLETT_CAVE, condition=[CUT]) G.add_edge('Route 12', 'Route 13', condition=None) - G.add_edge('Route 12', 'Lavender Town', condition=None) - G.add_edge('Route 7', 'Lavender Town', condition=None) - G.add_edge('Route 9', 'Route 10', condition=None) - G.add_edge('Route 10', 'Rock Tunnel', condition=None) - G.add_edge('Lavender Town', 'Rock Tunnel', condition=None) + G.add_edge('Route 12', LAVENDER_TOWN, condition=None) + G.add_edge('Route 7', LAVENDER_TOWN, condition=None) + G.add_edge(LAVENDER_TOWN, 'Route 10', condition=None) + G.add_edge('Route 9', 'Rock Tunnel', condition=[FLASH]) + G.add_edge('Route 10', 'Rock Tunnel', condition=[FLASH]) G.add_edge('Celadon City', 'Route 8', condition=None) G.add_edge('Celadon City', 'Route 16', condition=None) - G.add_edge('Route 16', 'Route 17', condition=None) - G.add_edge('Route 17', 'Route 18', condition=None) - G.add_edge('Route 18', 'Fuchsia City', condition=None) + G.add_edge('Route 16', 'Route 17', condition=[POKE_FLUTE]) + G.add_edge('Route 17', 'Route 18', condition=[BIKE]) + G.add_edge('Route 18', 'Fuchsia City', condition=[BIKE]) G.add_edge('Fuchsia City','Route 19', condition=None) G.add_edge('Fuchsia City','Route 15', condition=None) G.add_edge('Fuchsia City','Safari Zone', condition=None) - G.add_edge('Route 19', 'Seafoam Islands', condition=None) - G.add_edge('Seafoam Islands', 'Route 20', condition=None) - G.add_edge('Route 20', 'Cinnabar Island', condition=None) - G.add_edge('Route 21', 'Cinnabar Island', condition=None) + G.add_edge('Route 19', 'Seafoam Islands', condition=[SURF]) + G.add_edge('Seafoam Islands', 'Route 20', condition=[SURF]) + G.add_edge('Route 20', 'Cinnabar Island', condition=[SURF]) + G.add_edge('Route 21', 'Cinnabar Island', condition=[SURF]) G.add_edge('Route 22', 'Viridian City', condition=None) - G.add_edge('Route 22', 'Route 23', condition=None) - G.add_edge('Route 23', 'Victory Road', condition=None) + G.add_edge('Route 22', 'Route 23', condition=[SURF]) + G.add_edge('Route 23', 'Victory Road', condition=[BOULDER_BADGE, CASCADE_BADGE, THUNDER_BADGE, RAINBOW_BADGE, MARSH_BADGE, SOUL_BADGE, VOLCANO_BADGE, EARTH_BADGE]) G.add_edge('Victory Road', 'Indigo Plateau', condition=None) G.add_edge('Route 12', 'Route 13', condition=None) G.add_edge('Route 13', 'Route 14', condition=None) G.add_edge('Route 14', 'Route 15', condition=None) - G.add_edge('Route 24', 'Cerulean Cave', condition=None) - G.add_edge('Route 10', 'Power Plant', condition=None) + G.add_edge('Route 24', 'Cerulean Cave', condition=[SURF, CHAMPION]) + G.add_edge('Route 10', 'Power Plant', condition=[SURF]) G.add_edge('Route 5', 'Underground Path', condition=None) G.add_edge('Underground Path', 'Route 6', condition=None) + G.add_edge(LAVENDER_TOWN, POKEMON_TOWER, condition=[SILPH_SCOPE]) + G.add_edge(UNDERGROUND_PASSAGE, 'Route 7', condition=None) + G.add_edge(UNDERGROUND_PASSAGE, 'Route 8', condition=None) + net = Network(notebook=True) for node, attrs in G.nodes(data=True):