def Run(self): self._universe = Universe() w = World(self._universe, 0, self._maze._entrance, self._maze, "", {}, "") self._universe.AddWorldsForEvaluation([w]) solutionWorld = self._universe.Run() print(f"Short path to solution is {solutionWorld._generation}.") return solutionWorld._generation
def init(): """ Game initialization function. 1. Creates a L{Debugger} (debugger) and L{EventTimer} (eventTimer) and stores references to them in an instance of L{EventManager}. 2. Several listeners are started and registered with eventManager: - Instance of L{Universe} (universe) - Instance of L{UserInterface} (ui) - Instance of L{Window} (gameWindow) 3. We send the eventManager a message to start the game - This message is interpreted by the gameWindow """ debugger = Debugger() eventTimer = EventTimer() #Create the event manager for low-level events eventManager = Manager(eventTimer,debugger) #FIXME: more specific manager\ #classes will be needed later? try: client = GameClient(eventManager,host='10.41.24.79',port=1567) except: pass #Create the occurence manager for high-level events (same across client and server) #FIXME: NOT YET IMPLEMENTED #Note: Do we even need this anymore? - Julian #Response: I don't think so. - Jared #=========================================== #Create and register the standard listeners #With the event manager #=========================================== #FIXME: Not yet fully implemented #THIS WILL BE CHANGED LATER TO ACCOUNT FOR LOADING, ETC. # World w is set to the activeWorld of the universe universe = Universe(eventManager) ui = UserInterface(eventManager,universe.activeWorld) gameWindow = Window(eventManager,width=1024,height=768) w = World() universe.changeWorld(w) #=========================================== # Initialize 500 entities in World w for i in range(100): #w.addEntity(Entity('ball.png',i*50,i*50, w, (255,255,255))) #w.addEntity(TestEntity('testBuilding.png', i*50, i*50, w, 'alpha')) w.addEntity(TestEntity('testCraft.png',i*50,i*50,w,'alpha')) eventManager.post(Event.WorldManipulationEvent()) #Notify the manager that the window should start to accept input: eventManager.post(Event.StartEvent()) return eventManager.eventTypesToListeners
def __init__(self, info, lx, ly, max_age, split_energy, is_debug=False): self.universe = Universe(info, lx, ly) self.spotties = list() self.population = dict() self.population_tot = 0 self.max_age = max_age self.split_energy = split_energy self._is_debug = is_debug
def start_game(self, player, difficulty): """Starts the game and instantiates all objects/attributes player -- the player that's added to the game difficulty -- the game's difficulty """ self.difficulty = difficulty self.player = player self.universe = Universe( ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'], [], self.player.credits) self.curr_region = self.universe.pick_random_region() self.npc = None
def start_game(self): newUniverse = Universe(self.regions) regionNum = random.randint(0, 9) player = app.player player.ship = Ship("Clipper") player.region = Universe.get_instance().regions[regionNum] if (self.difficulty is 'easy'): player.credits = 1000 elif (self.difficulty is 'medium'): player.credits = 500 else: player.credits = 100
def reset(): global region_name_list region_name_list = [ "Blue light", "Ard", "Shreyu", "North Avenue East", "Florida Man", "Cookout", "Emory", "Bidet", "Braces", "Gorilla" ] global universe universe = Universe(region_name_list, 0, None) global universe_list universe_list = universe.__str__() global special_item_key special_item_key = randint(0, 9) global engineer engineer = 0 global pilot pilot = 0 global merchant merchant = 0 global fighter fighter = 0 global region region = Universe.regions[1] global credit credit = 0 global inventory inventory = {} player.set_engineer(0) player.set_pilot(0) player.set_merchant(0) player.set_fighter(0) player.set_fighter(0) player.set_region(Universe.regions[1]) player.set_credit(0) player.set_inventory({}) global npc_encounter npc_encounter = False global old_location old_location = "" global flee flee = False global karma karma = 0 player.get_ship().ship_health = player.get_ship().max_ship_health player.get_ship().fuel_capacity = player.get_ship().max_fuel_capacity player.get_ship().cargo_space = player.get_ship().max_cargo_space
def byzantium(): global player this_region = Universe.get_instance().regions[8] market_list = {} for item in player.region.market.items.keys(): market_list[item] = player.region.market.items[item].buy_value region_info = { 'region_x': this_region.getX(), 'region_y': this_region.getY(), 'region_tech': this_region.getTechLevel(), 'market': market_list, 'inventory': player.inventory, 'fuel': player.ship.fuel, 'health': player.ship.health, 'credits': player.credits } regions = Universe.get_instance().regions fuel_costs = {} for i in regions: fuel_costs[i.get_name()] = regions[8].get_fuel_cost( i.getX(), i.getY(), player) region_info['fuel_costs'] = fuel_costs if player.region.get_name() != 'Byzantium': trav = player.travel(this_region, game) else: trav = {} if 'enc' in trav: if trav['enc'] == "Trader": return render_template('NPCs/Trader.html', toRegion=trav['toRegion']) elif trav['enc'] == "Pirate": return render_template('NPCs/Pirate.html', toRegion=trav['toRegion']) elif trav['enc'] == "Navy": return render_template('NPCs/Navy.html', toRegion=trav['toRegion']) else: this_region.market.populate_market(player) return render_template("Regions/Byzantium.html", region_info=region_info) if (player.ship.health == 0): return render_template('GameOver.html')
def steps_to_repeat_per_axis(universe): initial_universe = copy(universe) steps_to_repeat = [] for axis in ['x', 'y', 'z']: moons = [parse_moon(str) for str in inputs] universe = Universe(moons) universe.step() while not universe.equal_on_axis(axis, initial_universe): universe.step() steps_to_repeat.append(universe.steps) return steps_to_repeat
class Day18Driver: def __init__(self): self._maze = None self._universe = None def Run(self): self._universe = Universe() w = World(self._universe, 0, self._maze._entrance, self._maze, "", {}, "") self._universe.AddWorldsForEvaluation([w]) solutionWorld = self._universe.Run() print(f"Short path to solution is {solutionWorld._generation}.") return solutionWorld._generation def LoadMaze(self,mazeData): highestKey = 0 mazeData = mazeData.strip() mazeLines = mazeData.split("\n") totalY = len(mazeLines) totalX = max(map(lambda line : len(line), mazeLines)) self._maze = maze = Maze(totalY, totalX) for y,line in enumerate(mazeLines): for x,val in enumerate(list(line)): if maze._lowKey <= ord(val) <= maze._highKey: if (ord(val)> highestKey): highestKey = ord(val) pos = (y,x) if (val=="@"): self._start = pos maze.AddPoint(pos,val) maze._highKey = highestKey maze._highDoor = highestKey - 32 def DoTest(self, numberOfMovesExpected,mazeData): d.LoadMaze(mazeData) steps = d.Run() assert(steps==numberOfMovesExpected)
def main(self): video_flags = OPENGL | DOUBLEBUF pygame.init() locale.setlocale(locale.LC_ALL, "") try: displayInfo = pygame.display.Info() width, height = self.resolution width = min(width, displayInfo.current_w) height = min(height, displayInfo.current_h - 20) self.resolution = width, height pygame.display.set_mode(self.resolution, video_flags) pygame.key.set_repeat(100,0) self.resize(*self.resolution) self.initGL() self.universe = Universe() self.dashboard = Dashboard(self.universe.userSpaceship) self.dashboard.relativeTo = self.universe.initialDashboardRelativeTo frames = 0 ticks = pygame.time.get_ticks() lastTicks = ticks while not self.done: self.handleEvent() self.draw() currentTicks = pygame.time.get_ticks() self.universe.accelerateAndMove(float(currentTicks - lastTicks) / 1000) pygame.display.flip() frames += 1 lastTicks = currentTicks print "fps: %d" % ((frames * 1000) / (pygame.time.get_ticks() - ticks)) finally: pygame.quit()
class Game: def __init__(self, initial_configuration=0, dimension=8): self.dimension = dimension self.initial_configuration = initial_configuration self.universe = Universe(initial_configuration, dimension) def print_nicely(self): self.universe.print_nicely() def play(self): keep_going = True while (keep_going): choice = input('>') if choice != 0: self.universe.progress_one_generation() self.universe.print_nicely() else: keep_going = False
def __init__(self, initial_configuration=0, dimension=8): self.dimension = dimension self.initial_configuration = initial_configuration self.universe = Universe(initial_configuration, dimension)
class Game: """ The game class containing Player, Difficulty, Universe, and Current Region """ def __init__(self): self.difficulty = None self.player = None self.universe = None self.curr_region = None self.npc = None def start_game(self, player, difficulty): """Starts the game and instantiates all objects/attributes player -- the player that's added to the game difficulty -- the game's difficulty """ self.difficulty = difficulty self.player = player self.universe = Universe( ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'], [], self.player.credits) self.curr_region = self.universe.pick_random_region() self.npc = None def travel(self, region): distance = ( (self.curr_region.x_coord - region.x_coord)**2 + (self.curr_region.y_coord - region.y_coord)**2)**(1 / 2) / 10 if distance != 0: fuel_cost = distance - self.player.pilot if fuel_cost < 0: fuel_cost = 0 if self.player.ship.current_fuel >= fuel_cost: self.player.ship.current_fuel -= fuel_cost return True return False return False def buy(self, item_key, value): if self.player.credits >= value and len( self.player.ship.inventory) < self.player.ship.cargo_space: self.player.credits -= value self.player.ship.inventory.append(item_key) return True else: return False def sell(self, item_key): self.player.credits += self.curr_region.market.get(item_key) self.player.ship.inventory.remove(item_key) def loseCredits(self, amount): self.player.credits -= amount def loseItem(self, item_key): self.player.credits += 3 self.player.ship.inventory.remove(item_key) def loseRandomItem(self): self.player.ship.inventory.remove( random.choice(self.player.ship.inventory)) def refuel(self): fuelToFill = 100 - self.player.ship.current_fuel cost = fuelToFill / 3 if cost <= self.player.credits: self.player.ship.current_fuel = 100 self.player.credits -= cost return True else: return False def repair(self): repairs = 100 - self.player.ship.health cost = repairs / 3 - self.player.engineer if cost <= self.player.credits: self.player.ship.health = 100 self.player.credits -= cost return True return False def loseAllCredits(self): self.player.credits = 0 def loseAllItems(self): self.player.ship.inventory = [] def encounter(self): encounterChance = random.randint(0, 1) if encounterChance == 1: if self.difficulty == "Easy": chance = random.randint(1, 6) if chance == 1: randAttacker = random.randint(0, 1) if randAttacker == 0: if len(self.player.ship.inventory) > 0: self.npc = Police() else: self.npc = Bandit(self.difficulty) else: self.npc = Bandit(self.difficulty) else: self.npc = Trader(self.curr_region) if self.difficulty == "Medium": chance = random.randint(1, 6) if chance > 1 and chance < 4: randAttacker = random.randint(0, 1) if randAttacker == 0: if len(self.player.ship.inventory) > 0: self.npc = Police() else: self.npc = Bandit(self.difficulty) else: self.npc = Bandit(self.difficulty) else: self.npc = Trader(self.curr_region) if self.difficulty == "Hard": chance = random.randint(3, 6) if chance > 3: randAttacker = 0 if randAttacker == 0: if len(self.player.ship.inventory) > 0: self.npc = Police() else: self.npc = Bandit(self.difficulty) else: self.npc = Bandit(self.difficulty) else: self.npc = Trader(self.curr_region) else: self.npc = None
class UI(object): def __init__(self): self.resolution = (1280, 1024) # Vertical field of view self.fovV = 45 self.minClipping = 0.1 self.maxClipping = 5000000000000 self.done = False self.dragging = False self.dragLastEvent = None self.cameraDistance = 0.6 def resize(self, width, height): if height == 0: height = 1.0 glViewport(0, 0, width, height) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(self.fovV, float(width) / height, self.minClipping, self.maxClipping) glMatrixMode(GL_MODELVIEW) def initGL(self): glShadeModel(GL_SMOOTH) glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0) glEnable(GL_DEPTH_TEST) glDepthFunc(GL_LEQUAL) glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) glEnable(GL_TEXTURE_2D) glPushMatrix() glLoadIdentity() self.cameraRotationMatrix = glGetFloatv(GL_MODELVIEW_MATRIX) glPopMatrix() def handleKeys(self, key): if key == K_LESS or key == K_COMMA: self.universe.userSpaceship.thrust -= 1 elif key == K_GREATER or key == K_PERIOD: self.universe.userSpaceship.thrust += 1 elif key == K_SLASH: self.universe.userSpaceship.thrust = 0 elif key == K_s: self.universe.userSpaceship.rotateBy(3, (1, 0, 0)) elif key == K_w: self.universe.userSpaceship.rotateBy(-3, (1, 0, 0)) elif key == K_q: self.universe.userSpaceship.rotateBy(3, (0, 1, 0)) elif key == K_e: self.universe.userSpaceship.rotateBy(-3, (0, 1, 0)) elif key == K_a: self.universe.userSpaceship.rotateBy(3, (0, 0, 1)) elif key == K_d: self.universe.userSpaceship.rotateBy(-3, (0, 0, 1)) elif key == K_j: self.universe.userSpaceship.jump() def handleMousedown(self, event): if event.button == 1: self.dragging = True self.dragLastEvent = pygame.mouse.get_pos() if event.button == 4: # Mouse wheel roll up self.cameraDistance -= 0.01 elif event.button == 5: # Mouse wheel roll down self.cameraDistance += 0.01 def handleMouseup(self, event): if event.button == 1: if self.dragging: self.dragging = False self.dragLastEvent = None def handleMousemove(self, event): if self.dragging: nowX, nowY = pygame.mouse.get_pos() thenX, thenY = self.dragLastEvent deltaX = nowX - thenX deltaY = nowY - thenY glPushMatrix() glLoadIdentity() glRotatef(float(deltaX) / (360. / self.fovV), 0, 1, 0) glRotatef(float(deltaY) / (360. / self.fovV), 1, 0, 0) glMultMatrixf(self.cameraRotationMatrix) self.cameraRotationMatrix = glGetFloatv(GL_MODELVIEW_MATRIX) glPopMatrix() self.dragLastEvent = nowX, nowY def handleEvent(self): event = pygame.event.poll() if event.type == NOEVENT: return elif event.type == KEYDOWN: self.handleKeys(event.key) elif event.type == MOUSEBUTTONDOWN: self.handleMousedown(event) elif event.type == MOUSEBUTTONUP: self.handleMouseup(event) elif event.type == MOUSEMOTION: self.handleMousemove(event) elif event.type == QUIT: self.done = True def draw(self): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glLoadIdentity() self.resize(*self.resolution) glTranslatef(0, 0, -self.cameraDistance) glMultMatrixf(self.cameraRotationMatrix) self.universe.draw() self.dashboard.draw(*self.resolution) def main(self): video_flags = OPENGL | DOUBLEBUF pygame.init() locale.setlocale(locale.LC_ALL, "") try: displayInfo = pygame.display.Info() width, height = self.resolution width = min(width, displayInfo.current_w) height = min(height, displayInfo.current_h - 20) self.resolution = width, height pygame.display.set_mode(self.resolution, video_flags) pygame.key.set_repeat(100,0) self.resize(*self.resolution) self.initGL() self.universe = Universe() self.dashboard = Dashboard(self.universe.userSpaceship) self.dashboard.relativeTo = self.universe.initialDashboardRelativeTo frames = 0 ticks = pygame.time.get_ticks() lastTicks = ticks while not self.done: self.handleEvent() self.draw() currentTicks = pygame.time.get_ticks() self.universe.accelerateAndMove(float(currentTicks - lastTicks) / 1000) pygame.display.flip() frames += 1 lastTicks = currentTicks print "fps: %d" % ((frames * 1000) / (pygame.time.get_ticks() - ticks)) finally: pygame.quit()
print("SPACE TRADER \n") input_name = input("Enter your name: ") print("NAME: " + input_name) allocate_points() choose_difficulty() test_player = Player(input_name, skills, difficulty) print(test_player.get_name()) print(test_player.get_skills()) print(test_player.get_difficulty()) print(test_player.get_credits()) print(test_player.get_ship_type()) test_universe = Universe() for solar in test_universe.get_solar_systems(): print(solar.get_name()) print(solar.get_coords()) print(solar.get_tech_level()) print(solar.get_resources()) print("END")
def main(): my_universe = Universe(2**15) my_universe.display_universe() my_probe = Probe(my_universe, randint(2**3, 2**64), randint(2**3, 2**64), randint(2**3, 2**64)) my_probe.search_for_life()
# app = Flask(__name__) # # #http://flask.palletsprojects.com/en/1.1.x/quickstart/#rendering-templates import os import sys from flask import Flask, render_template, request from Universe import Universe, Player, Item, Market from random import randint app = Flask(__name__) region_name_list = [ "Blue light", "Ard", "Shreyu", "North Avenue East", "Florida Man", "Cookout", "Emory", "Bidet", "Braces", "Gorilla" ] universe = Universe(region_name_list, 0, None) universe_list = universe.__str__() special_item_key = randint(0, 9) name = "RITHIK" engineer = 0 pilot = 0 merchant = 0 fighter = 0 region = Universe.regions[1] credit = 0 ship = "None" inventory = {} player = Player(name, engineer, pilot, merchant, fighter, region, credit, ship, inventory) wood = Item("Wood", 27, [ "AGRICULTURE", "MEDIEVAL", "RENAISSANCE", "INDUSTRIAL", "MODERN",
f = open("Input12.txt") inputs = f.read().splitlines() f.close() def parse_moon(string): m = re.search(r'<x=(-?\d+), y=(-?\d+), z=(-?\d+)>', string) x, y, z = int(m.group(1)), int(m.group(2)), int(m.group(3)) return Moon(x, y, z) # --- Part 1 --- moons = [parse_moon(str) for str in inputs] universe = Universe(moons) for _ in range(1000): universe.step() print(universe.total_energy()) # --- Part 2 --- def lowest_common_multiple(nums): lcm = nums[0] for i in nums[1:]: lcm = int(lcm*i/math.gcd(lcm, i)) return lcm def steps_to_repeat_per_axis(universe):
def main(): uni = Universe(2**10)
class GameBasic: def __init__(self, info, lx, ly, max_age, split_energy, is_debug=False): self.universe = Universe(info, lx, ly) self.spotties = list() self.population = dict() self.population_tot = 0 self.max_age = max_age self.split_energy = split_energy self._is_debug = is_debug def add_spotties_random(self, new_pop, info): pop0 = self.spotties.__len__() for n in range(0, new_pop): self.spotties.append(Spotty(info, self.max_age, self.split_energy)) self.spotties[n + pop0].enter_map_random( self.universe.map['tribe']) self.universe.put_universe(self.spotties[n + pop0]) def add_spotty_positions(self, info, positions): new_pop = len(positions) pop0 = self.spotties.__len__() for n in range(0, new_pop): self.spotties.append(Spotty(info, self.max_age, self.split_energy)) self.spotties[n + pop0].enter_map_position(positions[n]) self.universe.put_universe(self.spotties[n + pop0]) def spotty_split_random(self, nth): # split the nth spotty neighbor1 = self.universe.read_map(self.spotties[nth], 1) movement = np.nonzero(neighbor1['tribe'] == 0) rand_pos = np.random.randint(0, len(movement[1]), 1) movement = movement[1][rand_pos[0]] + 1 new_pos = find_position_from_movement(self.spotties[nth].position, movement) new = spotty_copy(self.spotties[nth]) new.enter_map_position(new_pos) self.universe.put_universe(new) self.spotties.append(new) self.spotties[nth].energy = 0 self.spotties[nth].age += 1 def spotty_move(self, nth, decision): self.universe.delete_universe(self.spotties[nth]) self.spotties[nth].move(decision) self.universe.put_universe(self.spotties[nth]) self.spotties[nth].age += 1 def spotty_die(self, nth): self.universe.delete_universe(self.spotties[nth]) self.spotties.__delitem__(nth) def update_population_info(self): self.population_tot = self.spotties.__len__() self.population = dict() for s in self.spotties: for p in s.info: if p in self.population: self.population[p] += 1 else: self.population[p] = 1
def run(): '''does the things''' name = input('Input file => ') print(name) data = json.loads(open(name).read()) collisions = [] step = 0 stopped = set() p_by_u = dict() #{universe: [portals]} r_by_u = dict() #{universe: [rewards]} u_by_r = dict() #{reward: universe} universes = [ Universe(uni['universe_name'], uni['rewards'], uni['portals']) for uni in data ] for uni in universes: p_by_u[uni.name] = uni.portals r_by_u[uni.name] = uni.rewards for uni in universes: for reward in uni.rewards: u_by_r[reward[3]] = uni.name persons = [Person(person[0], person[1], uni['universe_name'], person[2], person[3], person[4],\ person[5], uni['universe_name']) for uni in data for person in uni['individuals']] start(universes, data) for person in persons: #check boundary conditions loc_check = bool(person.x <= 0 or person.x >= 1000 or person.y <= 0 or person.y >= 1000) speed_check = bool(-10 < person.dx < 10 or -10 < person.dy < 10) if person.movable and (loc_check or speed_check): person.movable = False temp = deepcopy(person) fix(temp) print('{} stopped at simulation step {} at location ({},{})\n'.format(\ temp.name, step, temp.x, temp.y)) stopped.add(person) while step < 100 and len(stopped) < len(persons): step += 1 for person in persons: #check if the person can move if person.movable: person.move() for person in persons: #check boundary conditions if person.movable and (person.x <= 0 or person.x >= 1000 or person.y <= 0 or person.y >= 1000): person.movable = False temp = deepcopy(person) fix(temp) print('{} stopped at simulation step {} at location ({},{})\n'.format(\ temp.name, step, temp.x, temp.y)) stopped.add(person) #Check for rewards for person in persons: #check if person can do anything if person not in stopped: #check if person is near reward for reward in r_by_u[person.current_universe]: if sqrt((person.x - reward[0])**2 + (person.y - reward[1])**2) <= person.radius: temp = r_by_u[person.current_universe] name = reward[3] person.rewards.append(temp.pop(temp.index(reward))) n = len(person.rewards) new = pickup_r(person, n) person.dx, person.dy = new[0], new[1] print('{} picked up "{}" at simulation step {}'.format( person.name, name, step)) temp = copy(person) print(temp, end='\n\n') #check stop conditions if abs(person.dx) < 10 or abs(person.dy) < 10: person.movable = False temp = copy(person) print('{} stopped at simulation step {} at location ({},{})\n'.format(\ temp.name, step, temp.x, temp.y)) stopped.add(person) #Check for collisions for person in persons: #check if person can do anything if person not in stopped: #check for collisions for other in persons: if other not in stopped: if person.name != other.name and person.current_universe == other.current_universe: temp1, temp2 = copy(person), copy(other) distance = sqrt((temp1.x - temp2.x)**2 + (temp1.y - temp2.y)**2) if distance <= (person.radius + other.radius) and\ (other.name, person.name) not in collisions: collisions.append((person.name, other.name)) print('{} and {} crashed at simulation step {} in universe {}'.format\ (person.name, other.name, step, person.current_universe)) if person.rewards: post_col(person, u_by_r, r_by_u) if other.rewards: post_col(other, u_by_r, r_by_u) temp1 = copy(person) temp2 = copy(other) print(str(temp1), str(temp2), '', sep='\n') elif distance > person.radius + other.radius: if (other.name, person.name) in collisions: collisions.remove( (other.name, person.name)) if (person.name, other.name) in collisions: collisions.remove( (person.name, other.name)) #Check for portals for person in persons: #check if person can do anything if person not in stopped: #check for portalling for portal in p_by_u[person.current_universe]: if sqrt((person.x - portal[0])**2 + (person.y - portal[1])**2) <= person.radius: person.x, person.y, person.current_universe = portal[ 3], portal[4], portal[2] print( '{} passed through a portal at simulation step {}'. format(person.name, step)) temp = copy(person) print(temp, end='\n\n') if (abs(person.dx) < 10 or abs(person.dy) < 10) and person.movable: person.movable = False temp = copy(person) print('{} stopped at simulation step {} at location ({},{})\n'.format(\ temp.name, step, temp.x, temp.y)) stopped.add(person) for person in persons: fix(person) results = (persons, stopped, step) end(results)
from Map import Map import numpy as np from City import City from Universe import Universe from pyquil.quil import Program map_matrix = np.matrix('1 1 1 1; 1 1 1 1; 1 1 1 1; 1 1 1 1') map = Map(map_matrix) cities = [City(identity=i) for i in range(4)] program = Program() universe = Universe(cities=cities, map=map, program=program)