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.
206 lines
8.7 KiB
206 lines
8.7 KiB
import networkx as nx
|
|
from networkx import Graph
|
|
|
|
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'
|
|
MEWTWO = 'Mewtwo'
|
|
ARCTICUNO = 'Arcticuno'
|
|
ZAPDOS = 'Zapdos'
|
|
MOLTRES = 'Moltres'
|
|
|
|
CUT = 'Cut'
|
|
SURF = 'Surf'
|
|
FLASH = 'Flash'
|
|
STRENGTH = 'Strength'
|
|
|
|
def get_red_blue_route() -> Graph:
|
|
G = nx.Graph()
|
|
|
|
for i in range(1,25):
|
|
G.add_node(f'Route {i}', node_type='route')
|
|
|
|
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.nodes[POWER_PLANT]['grants_conditions'] = [
|
|
{'condition': ZAPDOS, 'required_conditions': []}
|
|
]
|
|
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.nodes[CERULEAN_CAVE]['grants_conditions'] = [
|
|
{'condition': MEWTWO, 'required_conditions': []}
|
|
]
|
|
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[CINNABAR_ISLAND]['grants_conditions'] = [
|
|
{'condition': VOLCANO_BADGE, 'required_conditions': []}
|
|
]
|
|
G.add_node(SEAFOAM_ISLANDS, node_type='location')
|
|
G.nodes[SEAFOAM_ISLANDS]['grants_conditions'] = [
|
|
{'condition': ARCTICUNO, 'required_conditions': []}
|
|
]
|
|
G.add_node(VICTORY_ROAD, node_type='location')
|
|
G.nodes[VICTORY_ROAD]['grants_conditions'] = [
|
|
{'condition': MOLTRES, 'required_conditions': []}
|
|
]
|
|
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=[SURF])
|
|
G.add_edge('Route 1', 'Viridian City', condition=None)
|
|
G.add_edge('Viridian City', 'Route 2', condition=None)
|
|
G.add_edge('Route 2', 'Viridian Forest', condition=None)
|
|
G.add_edge('Route 2', 'Route 3', condition=[CUT])
|
|
G.add_edge('Viridian Forest', 'Pewter City', condition=None)
|
|
G.add_edge('Pewter City', 'Route 3', condition=None)
|
|
G.add_edge('Route 3', 'Mt. Moon', condition=None)
|
|
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=[CUT])
|
|
G.add_edge('Cerulean City', 'Route 5', 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('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(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=[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=[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=[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=[SURF, CHAMPION])
|
|
G.add_edge('Route 24', 'Route 25', condition=None)
|
|
G.add_edge('Route 25', BILLS_HOUSE, condition=None)
|
|
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)
|
|
|
|
return G
|