You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
231 lines
9.6 KiB
231 lines
9.6 KiB
import networkx as nx
|
|
from networkx import Graph
|
|
|
|
NEW_BARK_TOWN = 'New Bark Town'
|
|
CHERRYGROVE_CITY = 'Cherrygrove City'
|
|
VIOLET_CITY = 'Violet City'
|
|
SPROUT_TOWER = 'Sprout Tower'
|
|
RUINS_OF_ALPH = 'Ruins of Alph'
|
|
UNION_CAVE = 'Union Cave'
|
|
AZALEA_TOWN = 'Azalea Town'
|
|
SLOWPOKE_WELL = 'Slowpoke Well'
|
|
ILEX_FOREST = 'Ilex Forest'
|
|
GOLDENROD_CITY = 'Goldenrod City'
|
|
NATIONAL_PARK = 'National Park'
|
|
ECRUTEAK_CITY = 'Ecruteak City'
|
|
MOOMOO_FARM = 'MooMoo Farm'
|
|
OLIVINE_CITY = 'Olivine City'
|
|
CIANWOOD_CITY = 'Cianwood City'
|
|
MAHOGANY_TOWN = 'Mahogany Town'
|
|
LAKE_OF_RAGE = 'Lake of Rage'
|
|
TEAM_ROCKET_HQ = 'Team Rocket H.Q.'
|
|
ICE_PATH = 'Ice Path'
|
|
BLACKTHORN_CITY = 'Blackthorn City'
|
|
MT_MORTAR = 'Mt. Mortar'
|
|
TIN_TOWER = 'Tin Tower'
|
|
WHIRL_ISLANDS = 'Whirl Islands'
|
|
DARK_CAVE = 'Dark Cave'
|
|
VICTORY_ROAD = 'Victory Road'
|
|
INDIGO_PLATEAU = 'Indigo Plateau'
|
|
SS_AQUA = 'S.S. Aqua'
|
|
VERMILION_CITY = 'Vermilion City'
|
|
SAFFRON_CITY = 'Saffron City'
|
|
LAVENDER_TOWN = 'Lavender Town'
|
|
ROCK_TUNNEL = 'Rock Tunnel'
|
|
CERULEAN_CITY = 'Cerulean City'
|
|
CELADON_CITY = 'Celadon City'
|
|
FUCHSIA_CITY = 'Fuchsia City'
|
|
DIGLETTS_CAVE = "Diglett's Cave"
|
|
PEWTER_CITY = 'Pewter City'
|
|
MT_MOON = 'Mt. Moon'
|
|
VIRIDIAN_CITY = 'Viridian City'
|
|
PALLET_TOWN = 'Pallet Town'
|
|
CINNABAR_ISLAND = 'Cinnabar Island'
|
|
MT_SILVER = 'Mt. Silver'
|
|
SAFARI_ZONE = 'Safari Zone'
|
|
TOHJO_FALLS = 'Tohjo Falls'
|
|
|
|
CUT = 'Cut'
|
|
SURF = 'Surf'
|
|
FLASH = 'Flash'
|
|
STRENGTH = 'Strength'
|
|
ROCK_SMASH = 'Rock Smash'
|
|
WHIRLPOOL = 'Whirlpool'
|
|
WATERFALL = 'Waterfall'
|
|
|
|
ZEPHYR_BADGE = 'Zephyr Badge'
|
|
HIVE_BADGE = 'Hive Badge'
|
|
PLAIN_BADGE = 'Plain Badge'
|
|
FOG_BADGE = 'Fog Badge'
|
|
STORM_BADGE = 'Storm Badge'
|
|
MINERAL_BADGE = 'Mineral Badge'
|
|
GLACIER_BADGE = 'Glacier Badge'
|
|
RISING_BADGE = 'Rising Badge'
|
|
|
|
SQUIRTBOTTLE = 'Squirt bottle'
|
|
MEDICINE = 'Medicine'
|
|
CATCH_RED_GYRADOS = 'Catch Red Gryados'
|
|
ROCKET_DEAFEATED = 'Rocket Defeated'
|
|
OBTAIN_WING = 'Obtain Wing'
|
|
JOHTO_CHAMPION = 'Johto Champion'
|
|
S_S_TICKET = 'S.S. Ticket'
|
|
|
|
def get_gold_silver_route() -> Graph:
|
|
G = nx.Graph()
|
|
|
|
for i in range(1,46):
|
|
G.add_node(f'Route {i}', node_type='route')
|
|
|
|
G.add_node(NEW_BARK_TOWN, node_type='location')
|
|
G.add_node(CHERRYGROVE_CITY, node_type='location')
|
|
G.add_node(VIOLET_CITY, node_type='location')
|
|
G.add_node(SPROUT_TOWER, node_type='location')
|
|
G.add_node(RUINS_OF_ALPH, node_type='location')
|
|
G.add_node(UNION_CAVE, node_type='location')
|
|
G.add_node(AZALEA_TOWN, node_type='location')
|
|
G.add_node(SLOWPOKE_WELL, node_type='location')
|
|
G.add_node(ILEX_FOREST, node_type='location')
|
|
G.add_node(GOLDENROD_CITY, node_type='location')
|
|
G.add_node(NATIONAL_PARK, node_type='location')
|
|
G.add_node(ECRUTEAK_CITY, node_type='location')
|
|
G.add_node(MOOMOO_FARM, node_type='location')
|
|
G.add_node(OLIVINE_CITY, node_type='location')
|
|
G.add_node(CIANWOOD_CITY, node_type='location')
|
|
G.add_node(MAHOGANY_TOWN, node_type='location')
|
|
G.add_node(LAKE_OF_RAGE, node_type='location')
|
|
G.add_node(TEAM_ROCKET_HQ, node_type='location')
|
|
G.add_node(ICE_PATH, node_type='location')
|
|
G.add_node(BLACKTHORN_CITY, node_type='location')
|
|
G.add_node(MT_MORTAR, node_type='location')
|
|
G.add_node(TIN_TOWER, node_type='location')
|
|
G.add_node(WHIRL_ISLANDS, node_type='location')
|
|
G.add_node(DARK_CAVE, node_type='location')
|
|
G.add_node(VICTORY_ROAD, node_type='location')
|
|
G.add_node(INDIGO_PLATEAU, node_type='location')
|
|
G.add_node(SS_AQUA, node_type='location')
|
|
G.add_node(VERMILION_CITY, node_type='location')
|
|
G.add_node(SAFFRON_CITY, node_type='location')
|
|
G.add_node(LAVENDER_TOWN, node_type='location')
|
|
G.add_node(ROCK_TUNNEL, node_type='location')
|
|
G.add_node(CERULEAN_CITY, node_type='location')
|
|
G.add_node(CELADON_CITY, node_type='location')
|
|
G.add_node(FUCHSIA_CITY, node_type='location')
|
|
G.add_node(DIGLETTS_CAVE, node_type='location')
|
|
G.add_node(PEWTER_CITY, node_type='location')
|
|
G.add_node(MT_MOON, node_type='location')
|
|
G.add_node(VIRIDIAN_CITY, node_type='location')
|
|
G.add_node(PALLET_TOWN, node_type='location')
|
|
G.add_node(CINNABAR_ISLAND, node_type='location')
|
|
G.add_node(MT_SILVER, node_type='location')
|
|
G.add_node(SAFARI_ZONE, node_type='location')
|
|
G.add_node(TOHJO_FALLS, node_type='location')
|
|
|
|
G.add_edge(NEW_BARK_TOWN, 'Route 29', condition=None)
|
|
G.add_edge(CHERRYGROVE_CITY, 'Route 29', condition=None)
|
|
G.add_edge(CHERRYGROVE_CITY, 'Route 30', condition=None)
|
|
G.add_edge('Route 31', 'Route 30', condition=None)
|
|
G.add_edge('Route 30', DARK_CAVE, condition=None)
|
|
G.add_edge('Route 31', VIOLET_CITY, condition=None)
|
|
G.add_edge(VIOLET_CITY, 'Route 32', condition=None)
|
|
G.add_edge('Route 32', RUINS_OF_ALPH, condition=None)
|
|
G.add_edge('Route 32', UNION_CAVE, condition=None)
|
|
G.add_edge(UNION_CAVE, 'Route 33', condition=None)
|
|
G.add_edge(UNION_CAVE, RUINS_OF_ALPH, condition=None)
|
|
G.add_edge('Route 33', AZALEA_TOWN, condition=None)
|
|
G.add_edge(AZALEA_TOWN, ILEX_FOREST, condition=None)
|
|
G.add_edge(ILEX_FOREST, 'Route 34', condition=None)
|
|
G.add_edge(GOLDENROD_CITY, 'Route 34', condition=None)
|
|
G.add_edge(GOLDENROD_CITY, 'Route 35', condition=None)
|
|
G.add_edge(NATIONAL_PARK, 'Route 35', condition=None)
|
|
G.add_edge(NATIONAL_PARK, 'Route 36', condition=[SQUIRTBOTTLE])
|
|
G.add_edge(VIOLET_CITY, 'Route 36', condition=None)
|
|
G.add_edge('Route 37', 'Route 36', condition=[SQUIRTBOTTLE])
|
|
G.add_edge('Route 37', ECRUTEAK_CITY, condition=None)
|
|
G.add_edge('Route 38', ECRUTEAK_CITY, condition=None)
|
|
G.add_edge('Route 38', 'Route 39', condition=None)
|
|
G.add_edge('Route 39', OLIVINE_CITY, condition=None)
|
|
G.add_edge('Route 40', OLIVINE_CITY, condition=[SURF])
|
|
G.add_edge(OLIVINE_CITY, SS_AQUA, condition=[S_S_TICKET])
|
|
G.add_edge('Route 40', 'Route 41', condition=[SURF])
|
|
G.add_edge('Route 40', WHIRL_ISLANDS, condition=[SURF, WHIRLPOOL])
|
|
G.add_edge('Route 41', WHIRL_ISLANDS, condition=[SURF, WHIRLPOOL])
|
|
G.add_edge('Route 41', CIANWOOD_CITY, condition=[SURF])
|
|
G.add_edge('Route 47', CIANWOOD_CITY, condition=None)
|
|
G.add_edge('Route 47', 'Route 48', condition=None)
|
|
G.add_edge('Route 47', SAFARI_ZONE, condition=None)
|
|
G.add_edge('Route 42', ECRUTEAK_CITY, condition=None)
|
|
G.add_edge('Route 42', MT_MORTAR, condition=[SURF, WATERFALL])
|
|
G.add_edge('Route 42', MAHOGANY_TOWN, condition=[SURF])
|
|
G.add_edge('Route 43', MAHOGANY_TOWN, condition=None)
|
|
G.add_edge('Route 43', LAKE_OF_RAGE, condition=None)
|
|
G.add_edge('Route 44', MAHOGANY_TOWN, condition=[ROCKET_DEAFEATED])
|
|
G.add_edge(TEAM_ROCKET_HQ, MAHOGANY_TOWN, condition=[CATCH_RED_GYRADOS])
|
|
G.add_edge('Route 44', ICE_PATH, condition=[STRENGTH])
|
|
G.add_edge(BLACKTHORN_CITY, ICE_PATH, condition=[STRENGTH])
|
|
G.add_edge('Route 45', BLACKTHORN_CITY, condition=None)
|
|
G.add_edge('Route 45', DARK_CAVE, condition=[SURF])
|
|
G.add_edge('Route 45', 'Route 46', condition=None)
|
|
G.add_edge('Route 46', 'Route 29', condition=None)
|
|
G.add_edge('Route 46', DARK_CAVE, condition=[ROCK_SMASH])
|
|
G.add_edge('Route 26', NEW_BARK_TOWN, condition=[SURF, WATERFALL, WHIRLPOOL])
|
|
G.add_edge('Route 26', 'Route 27', condition=None)
|
|
G.add_edge('Route 28', 'Route 27', condition=None)
|
|
G.add_edge('Route 28', MT_SILVER, condition=None)
|
|
G.add_edge('Route 23', 'Route 27', condition=None)
|
|
G.add_edge('Route 23', VICTORY_ROAD, condition=[ZEPHYR_BADGE, HIVE_BADGE, PLAIN_BADGE, FOG_BADGE, STORM_BADGE, MINERAL_BADGE, GLACIER_BADGE, RISING_BADGE])
|
|
G.add_edge(VICTORY_ROAD, INDIGO_PLATEAU, condition=None)
|
|
G.add_edge('Route 22', 'Route 27', condition=None)
|
|
|
|
G.nodes[NEW_BARK_TOWN]['grants_conditions'] = [
|
|
{'condition': S_S_TICKET, 'required_conditions': [JOHTO_CHAMPION]}
|
|
]
|
|
G.nodes[VIOLET_CITY]['grants_conditions'] = [
|
|
{'condition': ZEPHYR_BADGE, 'required_conditions': []}
|
|
]
|
|
G.nodes[AZALEA_TOWN]['grants_conditions'] = [
|
|
{'condition': HIVE_BADGE, 'required_conditions': []}
|
|
]
|
|
G.nodes[ILEX_FOREST]['grants_conditions'] = [
|
|
{'condition': CUT, 'required_conditions': []}
|
|
]
|
|
G.nodes[GOLDENROD_CITY]['grants_conditions'] = [
|
|
{'condition': PLAIN_BADGE, 'required_conditions': []},
|
|
{'condition': SQUIRTBOTTLE, 'required_conditions': []},
|
|
{'condition': OBTAIN_WING, 'required_conditions': [GLACIER_BADGE]},
|
|
]
|
|
G.nodes[ECRUTEAK_CITY]['grants_conditions'] = [
|
|
{'condition': SURF, 'required_conditions': []},
|
|
{'condition': FOG_BADGE, 'required_conditions': []}
|
|
]
|
|
G.nodes['Route 36']['grants_conditions'] = [
|
|
{'condition': ROCK_SMASH, 'required_conditions': [SQUIRTBOTTLE]}
|
|
]
|
|
G.nodes[OLIVINE_CITY]['grants_conditions'] = [
|
|
{'condition': MINERAL_BADGE, 'required_conditions': [MEDICINE]},
|
|
{'condition': STRENGTH, 'required_conditions': []},
|
|
]
|
|
G.nodes[CIANWOOD_CITY]['grants_conditions'] = [
|
|
{'condition': STORM_BADGE, 'required_conditions': []},
|
|
{'condition': MEDICINE, 'required_conditions': []},
|
|
]
|
|
G.nodes[MAHOGANY_TOWN]['grants_conditions'] = [
|
|
{'condition': GLACIER_BADGE, 'required_conditions': [ROCKET_DEAFEATED]}
|
|
]
|
|
G.nodes[TEAM_ROCKET_HQ]['grants_conditions'] = [
|
|
{'condition': ROCKET_DEAFEATED, 'required_conditions': []},
|
|
{'condition': WHIRLPOOL, 'required_conditions': []}
|
|
]
|
|
G.nodes[LAKE_OF_RAGE]['grants_conditions'] = [
|
|
{'condition': CATCH_RED_GYRADOS, 'required_conditions': []}
|
|
]
|
|
G.nodes[ICE_PATH]['grants_conditions'] = [
|
|
{'condition': WATERFALL, 'required_conditions': []}
|
|
]
|
|
G.nodes[BLACKTHORN_CITY]['grants_conditions'] = [
|
|
{'condition': RISING_BADGE, 'required_conditions': []}
|
|
]
|
|
G.nodes[INDIGO_PLATEAU]['grants_conditions'] = [
|
|
{'condition': JOHTO_CHAMPION, 'required_conditions': []}
|
|
]
|
|
|
|
return G
|