def __init__(self, utilities): self.utilities = utilities player = Trader(utilities, "The player", [1, 1], [0, 0], 1000, [], []) dummy_player = Trader(utilities, "Dumb", [1, 1], [0, 0], 0, [], []) town1 = Town(utilities, 'Los Mantos', (-2, 0), 500, [10, 10], 'Coastal', []) town2 = Town(utilities, 'Kallac', (1, 1), 500, [10, 10], 'Karst', []) town3 = Town(utilities, 'Vinas', (2, -2), 500, [10, 10], 'Hilly', []) towns = [town1, town2, town3] traders = [player, dummy_player] self.world = World(utilities, 0, towns, traders) self.run_game = True self.input_action = None opening_text = ('The following options are available: ' 'description, trade, travel and check. ' 'When finished just type "exit game"') if utilities.run_through_terminal: print(opening_text) else: utilities.text_package = opening_text
def setup_world(): tool = SCENARIO[0] marks = SCENARIO[1:] tool.start() hud = HUD(10, WINDOW_HEIGHT - 22) world = World(marks, tool, hud) return world
class edgeClass(): def __init__(self, tempArray): self.x = tempArray[0] self.y = tempArray[1] self.z = tempArray[2] >>>>>>> branch 'master' of https://github.com/lylenchamberlain/teamx.git myWorld = World() edgeText = open('SF_edges.txt','r') #We might not need any of this due to the pickle file #Array of edge instances <<<<<<< HEAD edgeGraph = Graph() #Adds edges for x in range(len(myWorld.Edges)): Graph.add_edge(edgeGraph, myWorld.Edges[x][0], myWorld.Edges[x][1], myWorld.Edges[x][2]) #Random test for shortest path
class Game_interface: def __init__(self, utilities): self.utilities = utilities player = Trader(utilities, "The player", [1, 1], [0, 0], 1000, [], []) dummy_player = Trader(utilities, "Dumb", [1, 1], [0, 0], 0, [], []) town1 = Town(utilities, 'Los Mantos', (-2, 0), 500, [10, 10], 'Coastal', []) town2 = Town(utilities, 'Kallac', (1, 1), 500, [10, 10], 'Karst', []) town3 = Town(utilities, 'Vinas', (2, -2), 500, [10, 10], 'Hilly', []) towns = [town1, town2, town3] traders = [player, dummy_player] self.world = World(utilities, 0, towns, traders) self.run_game = True self.input_action = None opening_text = ('The following options are available: ' 'description, trade, travel and check. ' 'When finished just type "exit game"') if utilities.run_through_terminal: print(opening_text) else: utilities.text_package = opening_text def main_interface(self): player_town = self.world.player.current_town building_unlocked = False if (self.world.player.wallet >= 5000 or "property_owner" in self.world.player.properties): building_unlocked = True sensible = 0 try: if __name__ == '__main__': action = input('>: ') else: action = self.utilities.ask_action('') except Exception as e: print("(Unintelligible)") print(e) if action == 'description': player_town.describe() sensible = 1 if action == 'check': self.world.player.describe() sensible = 1 if action == 'trade': self.world.trade() sensible = 1 if action == 'travel': self.world.travel() sensible = 1 if action == 'build' and building_unlocked: self.world.build() sensible = 1 if action == 'interact': player_town.holdings[0].interact(self.world.player) sensible = 1 if action == 'exit game': self.run_game = False else: if sensible == 0: print('What?') def main_gameplay_loop(self): # regex this while self.run_game: self.main_interface()
from Classes.World import World from Classes.Graph import Graph from networkx.classes import graph graphObj = Graph() myWorld = World(graphObj) for j in range(len(myWorld.Edges)): graphObj.add_edge( myWorld.Edges[j][0], myWorld.Edges[j][1], myWorld.Edges[j][2], myWorld.Edges[j][3], myWorld.Edges[j][4] ) #graphObj.add_edge(myWorld.Edges[i][0], myWorld.Edges[i][1],myWorld.Edges[i][2]) for when we want to add actual time #set the floyd welch matrix up graphObj.setFloyd() ''' trying to see if there is a realtionship between time and length of an ''' print(graphObj.getNeighbor(101)) vtx = myWorld.Verticies myWorld.changeToViz(vtx) #draws the vertex's ''' print('locatin of trucks')