def generate_datum(): """Returns a synthetic Listing in the Phoenix area""" num_bedrooms = randint(1, 4) num_bathrooms = randint(1, 4) living_area = randint(1e3, 5e3) list_date = random_date(date(1999, 1, 1), date(2015, 6, 1)) list_price = randint(100e3, 500e3) lat = randint(33086, 33939) / float(1e3) lon = randint(-112649, -111437) / float(1e3) exterior_stories = randint(1, 3) pool = sample(House.POOL_TYPES, 1)[0] dwelling_type = sample(House.DWELLING_TYPES, 1)[0] is_closed = randrange(8) < 10 # 80% of listings close if is_closed: dom = randint(7, 180) list_to_close = normalvariate(0.03, 0.06) close_date = list_date + timedelta(days=dom) close_price = list_price * (1 - list_to_close) else: close_date = None close_price = None return House( House.listing(num_bedrooms, num_bathrooms, living_area, lat, lon, exterior_stories, pool, dwelling_type, list_date, list_price, close_date, close_price))
def getHouseDetail(htmltext): global conn house = House() soup = BeautifulSoup(htmltext, 'lxml') print(soup.title.string) houseinfo = soup.find('div', class_='house-title') houseBase = houseinfo.find('h1').string houseBase = re.split(r'[\s\,]', houseBase) housedate = houseinfo.find('span').string housedate = re.split(r'[\s\,]', housedate)[0] housedate = datetime.strptime(housedate, '%Y.%m.%d') house.deal_date = housedate house.estate_name = houseBase[0] house.proportion = float(houseBase[2].replace('平米', '')) price = soup.find('div', class_='price') totalPrice = price.find('i').string house.deal_price = float(totalPrice) * 10000 unitPrice = price.find('b').string house.unit_price = float(unitPrice) msgs = soup.find('div', class_='msg').find_all('span') msgs = list(msgs) house.sell_price = float(msgs[0].find('label').string) * 10000 house.deal_cycle = msgs[1].find('label').string DBSqlite.insert(house, conn) pass
class TestHouse(unittest.TestCase): def setUp(self): self.house = House() self.sim1 = self.house.move_in_sim('sim1', 20, 'w') self.sim2 = self.house.move_in_sim('sim2', 45, 'm') def test_move_in(self): self.house.move_in_sim('sim3', 4, 'w') self.assertEqual(self.house.family['sim3'].name, 'sim3') self.assertEqual(self.house.family['sim3'].age, 4) self.assertEqual(self.house.family['sim3'].sex, 'w') self.assertEqual(len(self.house.family), 3) def test_add_bathroom(self): self.house.add_bathroom() self.assertEqual(len(self.house.bathrooms), 2) def test_add_bedroom(self): self.house.add_bedroom(1) self.assertEqual(len(self.house.bedrooms), 2) def test_run(self): self.house.run(3) for s in self.house.family.values(): for v in s.needs.values(): self.assertEqual(v, 7) self.assertEqual(self.house.time, 3)
def main(): if activator.type != Type.PLAYER: return house = House(activator, GetOptions()) # Have the fees expires? if house.fees_expired(): # Get the cost. cost = house.get(house.fee) # Paid successfully? if activator.PayAmount(cost): pl.DrawInfo( "You have paid {} as your daily fee.".format(CostString(cost)), COLOR_GREEN) # Reset it to the current time. house.fees_reset() # Now add one more day. house.fees_add() # Failed to pay! else: pl.DrawInfo( "Your prepaid fees have expired and you do not have {} to pay for one more day." .format(CostString(cost)), COLOR_RED) (x, y) = house.get(house.fees_unpaid) activator.SetPosition(x, y)
def generate_test_set(): """Tries to read the test set from disk and generates and stores it if no test set is available """ try: House.read_serialized_object("../static/data/house_listings") except Exception as e: print "No test data available, Generating dataset: {0}".format(e.message) for k in range(0, NUM_LISTINGS): house = generate_datum() house.save() House.write_serialized_object("../static/data/house_listings")
def generate_test_set(): """Tries to read the test set from disk and generates and stores it if no test set is available """ try: House.read_serialized_object("../static/data/house_listings") except Exception as e: print "No test data available, Generating dataset: {0}".format( e.message) for k in range(0, NUM_LISTINGS): house = generate_datum() house.save() House.write_serialized_object("../static/data/house_listings")
def generate_datum(): """Returns a synthetic Listing in the Phoenix area""" num_bedrooms = randint(1, 4) num_bathrooms = randint(1, 4) living_area = randint(1e3, 5e3) list_date = random_date(date(1999, 1, 1), date(2015, 6, 1)) list_price = randint(100e3, 500e3) lat = randint(33086, 33939) / float(1e3) lon = randint(-112649, -111437) / float(1e3) exterior_stories = randint(1, 3) pool = sample(House.POOL_TYPES, 1)[0] dwelling_type = sample(House.DWELLING_TYPES, 1)[0] is_closed = randrange(8) < 10 # 80% of listings close if is_closed: dom = randint(7, 180) list_to_close = normalvariate(0.03, 0.06) close_date = list_date + timedelta(days=dom) close_price = list_price * (1 - list_to_close) else: close_date = None close_price = None return House(House.listing(num_bedrooms, num_bathrooms, living_area, lat, lon,exterior_stories, pool, dwelling_type, list_date, list_price, close_date, close_price))
def getHouse(self): house = House() doors = self.__builder.getDoors() gardenSize = self.__builder.getGarden() heating = self.__builder.getHeating() heatingPower = heating.heatingPower heatingType = heating.heatingType swimmingPool = self.__builder.getSwimmingPool() # Build the house house.setDoors(doors) house.setGarden(gardenSize) house.setHeating(heatingType, heatingPower) house.setSwimmingPool(swimmingPool) return house
def handle_message(json_msg): print('update') #print('Receive update from a client: ' + json_msg) fileJSON = json.loads(json_msg) House().updateValue(fileJSON) SocketWrapper().emmit_update(json_msg) print('update end')
def setUp(self): self.house = House() self.bathroom = self.house.bathrooms[0] self.bedroom = self.house.bedrooms[0] self.kitchen = self.house.kitchen self.livingroom = self.house.livingroom self.sim = Character('sim', 25, 'm', self.house) self.sim.needs_down()
def __init__(self): self.neighborhood = [] self.nsize = randint(2,5) for row in range(self.nsize): self.neighborhood.append([]) for col in range(self.nsize): self.neighborhood[row].append(House(randint(1,10))) self.neighborhood[row][col].add_observer(self)
def get_tenant_house(self, tenantEmail): tenantSnapshot = self._db.collection("Tenant").document( tenantEmail).get() reference = tenantSnapshot.get("houseReference") print(reference) houseSnapshot = self._db.document(reference.path).get() house = House(houseSnapshot.get("address"), houseSnapshot.get("rent"), houseSnapshot.get("size"), houseSnapshot.get("bedNumber"), houseSnapshot.get("bathNumber"), houseSnapshot.get("landlordEmail"), houseSnapshot.get("url"), houseSnapshot.get("description"), houseSnapshot.get("isPosted"), houseSnapshot.get("amenities"), houseSnapshot.get("utilities")) for profileReference in houseSnapshot.get("profiles"): profile = self._db.document(profileReference.path).get() p = Profile(profile.get("firstName"), profile.get("lastName"), profile.get("email"), profile.get("bio")) house.add_leaf(p) try: for tenantReference in houseSnapshot.get("tenants"): tenant = self._db.document(tenantReference.path).get() t = Tenant(tenant.get("firstName"), tenant.get("lastName"), tenant.get("password"), tenant.get("password2"), tenant.get("tenantEmail"), tenant.get("landlordEmail"), tenant.get("tenantRating")) house.add_leaf(t) except KeyError: print("Error: Tenant key error") return house.get_dictionary()
def main_menu(): welcome_menu() choice = input('>>> ') choice = choice.lower().strip() if choice == '1' or choice == 'play': house = House() house.start() elif choice == '2' or choice == 'help': help_menu() elif choice == '3' or choice == 'about': about_menu() elif choice == '4' or choice == 'exit': exit() else: print("This is not a valid option, please try again.") time.sleep(1) clear_screen() main_menu()
def __init__(self, numHomes): super(Neighborhood, self).__init__() self.Houses = [] for count in range(numHomes): newHouse = House(count) self.Houses.append(newHouse) self.add_Observer(newHouse) self.showNeighborhood()
def draw_houses(self, houses=3, stop=False): if houses > len(self.HOUSES): for add in range(1, houses - len(self.HOUSES) + 1): self.HOUSES.append(House((self.SCREEN_WIDTH * (self.GAP_BETWEEN_H_H * (len(self.HOUSES) + 1))) + (self.HEART_WIDTH * len(self.HOUSES)), self.SCREEN_LENGTH * 0.94)) for l in range(1, len(self.HOUSES) + 1): live = self.HOUSES[l - 1] if (houses == l and not stop) or houses > l: live.draw()
def __init__(self, height=5, width=5): """ Constructor to initialize the list of Houses :param height: height of the Houses array :param width: width of the House array """ # generate 2D array of houses. Houses will populate themselves self._houses = [[House() for x in range(width)] for y in range(height)]
def innit_data(houseslist, batterieslist, rand, batteries): houses = [] for house in houseslist: # clean up data temp = house.replace(' ', '').split(',') temp = [float(i) for i in temp] houses.append(House((temp[0], temp[1]), temp[2])) # save battery coords it they do not need to be random if rand == False: coords = [batteries[i].coord for i in batteries] batteries = {} for i in range(len(batterieslist)): cap = batterieslist[i][2] # place the batteries random if rand == True: battery_locations = [] house_locations = [house.coord for house in houses] coord = (random.randint(0, 50), random.randint(0, 50)) # try to get a battery placing where there is no house or other battery while coord in (house_locations + battery_locations): # make sure the battery is more than 15 places away from any ohter battery skip = -1 while skip < len(battery_locations): skip = 0 # get random coord coord = (random.randint(0, 50), random.randint(0, 50)) for location in battery_locations: if manhatten_distance(coord, location) < 10: break else: skip += 1 battery_locations.append(coord) # use coords previously saved else: coord = coords[i] batteries[i] = (Battery(coord, cap, i)) # calculate distances to all batteries from houses for house in houses: house.calc_distances(batteries) # calculate all distances to houses from batteries for battery in batteries: batteries[battery].calculate_distances(houses) return batteries, houses
def __init__(self): self.monster_count = 0 self.hood = [[0 for y in range(15)] for x in range(10)] for a in range(0, 10): for b in range(0, 15): if a == 3 or a == 6: if b == 11 or b == 12 or b == 13: self.hood[a][b] = "s" continue if b % 2 == 1: self.hood[a][b] = "y" continue else: self.hood[a][b] = House() self.hood[3][14] = "y" elif a == 0 or a == 9: if b % 2 == 1: self.hood[a][b] = "y" else: self.hood[a][b] = House() elif a == 1 or a == 2 or a == 7 or a == 8: self.hood[a][b] = "s" if b == 14 and (a == 1 or a == 8): self.hood[a][b] = "y" elif (a == 2 or a == 7) and b == 14: self.hood[a][b] = House() else: self.hood[a][b] = "y" self.hood[a][11] = "s" self.hood[a][12] = "s" self.hood[a][13] = "s" self.hood[4][14] = House() if isinstance(self.hood[a][b], House): self.hood[a][b].setObservers() self.monster_count = self.monster_count + self.hood[a][ b].getNumMonsters() self.hood[a][b].add_observer(self)
def add_house(self, houseRequest): if (self._db.collection("House").document( houseRequest["address"]).get().exists): return {"Result": "Error: House already exists"} houseRef = self._db.collection("House").document( houseRequest["address"]) landlordRef = self._db.collection("Landlord").document( houseRequest["landlordEmail"]) location = Location() locationData = location.get_location_from_address( houseRequest["address"]) house = House(houseRequest["address"], houseRequest["rent"], houseRequest["size"], houseRequest["bedNumber"], houseRequest["bathNumber"], houseRequest["landlordEmail"], locationData["url"], houseRequest["description"], False, houseRequest["amenities"], houseRequest["utilities"]) houseRef.set(house.get_dictionary()) houseRef.update({ "province": locationData["province"], "city": locationData["city"] }) houses = [] landlordSnapshot = landlordRef.get() try: houseReferences = landlordSnapshot.get("houses") for reference in houseReferences: houses.append(reference) houses.append(houseRef.get().reference) landlordRef.update({"houses": houses}) except KeyError: houses.append(houseRef.get().reference) landlordRef.update({"houses": houses}) return {"Result": "House added successfully"}
def __init__(self, numHomes): self.Houses = [] print("Ok, it looks like:\n") for count in range(numHomes): newHouse = House(count) self.Houses.append(newHouse) print(" - " + str(len(newHouse.Werewolves)) + " Werewolves\n" + " - " + str(len(newHouse.Persons)) + " Persons\n" + " - " + str(len(newHouse.Zombies)) + " Zombies\n" + " - " + str(len(newHouse.Vampires)) + " Vampires\n" + " - " + str(len(newHouse.Ghouls)) + " Ghouls\n")
def __init__(self, rows, cols): super(Neighborhood, self).__init__() self.rows, self.cols = rows, cols # adds houses to the neighborhood matrix self.__neighborhood = [[House() for x in range(0, self.cols)] for y in range(0, self.rows)] # make neighborhood observe all homes for row in range(0, self.rows): for col in range(0, self.cols): self.__neighborhood[row][col].add_observer(self) self.__total_monsters, self.__total_persons = self.__inHouseTotals()
def create_neighborhood(self): for id in range(self.size): has_token = False if id == 0: # Give token to first house only has_token = True # Add all the houses to the neighborhood self.neighborhood[id] = House( house_id=id, has_token=has_token, remaining_battery=self.remaining_energy_list[id], full_battery=self.full_battery)
def get_landlord_houses(self, email): landlordHouses = [] landlordSnapshot = self._db.collection("Landlord").document( email).get() if not landlordSnapshot.exists: return {"Result": "Error: Landlord does not exist"} try: for reference in landlordSnapshot.get("houses"): houseReference = self._db.document(reference.path).get() house = House(houseReference.get("address"), houseReference.get("rent"), houseReference.get("size"), houseReference.get("bedNumber"), houseReference.get("bathNumber"), houseReference.get("landlordEmail"), houseReference.get("url"), houseReference.get("description"), houseReference.get("isPosted"), houseReference.get("amenities"), houseReference.get("utilities")) try: for profileReference in houseReference.get("profiles"): profile = self._db.document( profileReference.path).get() p = Profile(profile.get("firstName"), profile.get("lastName"), profile.get("email"), profile.get("bio")) house.add_leaf(p) except KeyError: pass try: for tenantReference in houseReference.get("tenants"): tenant = self._db.document(tenantReference.path).get() t = Tenant(tenant.get("firstName"), tenant.get("lastName"), tenant.get("password"), tenant.get("password2"), tenant.get("tenantEmail"), tenant.get("landlordEmail"), tenant.get("tenantRating")) house.add_leaf(t) except KeyError: pass landlordHouses.append(house.get_dictionary()) except KeyError: return {"Result": "No houses found"} return landlordHouses
def search_houses(self, province, city, price, amenities): filteredHouses = [] houseCollection = self._db.collection("House").get() for houseDocument in houseCollection: if houseDocument.get("isPosted") == True: if houseDocument.get("province") == province: if houseDocument.get("city") == city: if houseDocument.get("rent") <= price: if houseDocument.get("amenities") == amenities: house = House( houseDocument.get("address"), houseDocument.get("rent"), houseDocument.get("size"), houseDocument.get("bedNumber"), houseDocument.get("bathNumber"), houseDocument.get("landlordEmail"), houseDocument.get("url"), houseDocument.get("description"), houseDocument.get("isPosted"), houseDocument.get("amenities"), houseDocument.get("utilities")) try: for profileReference in houseDocument.get( "profiles"): profile = self._db.document( profileReference.path).get() p = Profile(profile.get("firstName"), profile.get("lastName"), profile.get("email"), profile.get("bio")) house.add_leaf(p) except KeyError: pass try: for tenantReference in houseDocument.get( "tenants"): tenant = self._db.document( tenantReference.path).get() t = Tenant(tenant.get("firstName"), tenant.get("lastName"), tenant.get("password"), tenant.get("password2"), tenant.get("tenantEmail"), tenant.get("landlordEmail"), tenant.get("tenantRating")) house.add_leaf(t) except KeyError: pass filteredHouses.append(house.get_dictionary()) return filteredHouses
def __init__(self, g): UI.__init__(self) #self.apiToken = apiToken self.google = g # TODO: verify on creation that (self.data.short_name, self.data.fraternity, self.data.name) in list of contacts creates a unique person, if it doesn't we need to rethink the keys HouseData = collections.namedtuple( 'HouseData', spreadsheet_constants.house_data_header) ContactData = collections.namedtuple( 'ContactData', spreadsheet_constants.contact_data_header) print('Using the following namedtuple class for house data:') print(HouseData._fields) print('Using the following namedtuple class for contact data:') print(ContactData._fields) # maybe we should hold Iaddressees and Iemailaddresses in two lists self.houses = [] self.contacts = [] for data in g.get_clean_data( spreadsheet_constants.sheet_names['houses'], spreadsheet_constants.ffill_column_names['houses'] )[1:]: # skip the header self.houses.append( House( HouseData( *(data[:spreadsheet_constants.house_data_header_length] )))) for data in g.get_clean_data( spreadsheet_constants.sheet_names['contacts'], spreadsheet_constants.ffill_column_names['contacts'] )[1:]: # skip the header # look up the right house in the list of houses lookup_tuple = tuple( data[:spreadsheet_constants.columns_that_define_unique_house]) for house in self.houses: if lookup_tuple == house.data[:spreadsheet_constants. columns_that_define_unique_house]: self.contacts.append( Contact( ContactData( *(data[:spreadsheet_constants. contact_data_header_length - 1]), house.data)) ) # subtract 1 so we can add the house data named tuple to the contact data break print('Loaded {} houses and {} people'.format(len(self.houses), len(self.contacts)))
def __init__(self, local, houses): self.local = local if isinstance(houses, int): num_consumers = np.random.randint(0, houses / 2) rand_area = generate_random(houses - num_consumers, 5, 50, 15) rand_area = rand_area + [0 for i in range(num_consumers)] rand_people = generate_random(houses, 1, 6, 3) random.shuffle(rand_area) random.shuffle(rand_people) self.houses = [ House(rand_area.pop(), rand_people.pop(), local) for i in range(houses) ] else: self.houses = houses
def dowork(self): house=House() try: self.session.headers.update({'Host':'nj.lianjia.com'}) r = self.session.get(self.url, verify=False) if not self.savedetail(r.text, house): logging.warn("Can not save the detail info with url %s"%self.url); return None if not self.saveimg(r.text, house): logging.warn("Can not save the image with url %s"%self.url); return None return house except BaseException as ex: logging.error('catch an exception: %s'%str(ex)) return None
def main(): if activator.type != Type.PLAYER: return house = House(activator, GetOptions()) # Have the fees expires? if house.fees_expired(): # Get the cost. cost = house.get(house.fee) # Paid successfully? if activator.PayAmount(cost): pl.DrawInfo("You have paid {} as your daily fee.".format(CostString(cost)), COLOR_GREEN) # Reset it to the current time. house.fees_reset() # Now add one more day. house.fees_add() # Failed to pay! else: pl.DrawInfo("Your prepaid fees have expired and you do not have {} to pay for one more day.".format(CostString(cost)), COLOR_RED) (x, y) = house.get(house.fees_unpaid) activator.SetPosition(x, y)
def __init__(self, N=10, N_types=2, threshold=0.5, empty_percent=.2): #self.grid = np.array([]) self.grid = np.empty((N, N), dtype=House) self.N = N self.N_types = N_types self.threshold = threshold self.empty_proportion = empty_percent self.empty_set = set([]) #So the types will start at 1. 0 will be reserved for an empty spot. for i in range(N): for j in range(N): self.grid[i, j] = House(randint(1, N_types), (i, j)) if random() < self.empty_proportion: self.grid[i, j].type = 0 self.empty_set.add((i, j)) self.sim_avg = [] self.movement = []
batterieslist = loadbattery(batterypath) scores = [] highest_score = 1000 highest = [] attempt = 0 for i in range(1000): attempt += 1 # load houses object in a list houses = [] for house in houseslist: # clean up data temp = house.replace(' ', '').split(',') temp = [float(i) for i in temp] houses.append(House((temp[0], temp[1]), temp[2])) # load batteries in a dict with index as key and object as value batteries = {} for i in range(len(batterieslist)): battery = batterieslist[i] batteries[i] = Battery((battery[0], battery[1]), battery[2], i) # calculate distances to all batteries from houses for house in houses: house.calc_distances(batteries) # calculate all distances to houses from batteries for battery in batteries: batteries[battery].calculate_distances(houses)
def main(arg): make_json('locais/csv/' + arg[1] + '.csv', 'locais/json/' + arg[1] + '.json') with open('locais/json/' + arg[1]+str('.json'), 'r') as f: community_times = json.load(f) com = None if len(arg) == 6 and str(arg[4]+'.json') not in os.listdir('comunidades/'): com = Community(arg[1], int(arg[5])) community_data = {} i = 1 for house in com.houses: community_data[str(i)] = {} community_data[str(i)]['area'] = house.area community_data[str(i)]['sell'] = house.sell community_data[str(i)]['buy'] = house.buy j = 1 community_data[str(i)]['people'] = {} for person in house.persons: community_data[str(i)]['people'][str(j)] = person.profile[0] j+=1 i+=1 with open('comunidades/' + arg[4] + str('.json'), 'w') as f: json.dump(community_data,f, indent=4) else: with open('comunidades/' + arg[4]+str('.json'), 'r') as f: load = json.load(f) house_list = [] for house in load: area = load[house]['area'] people_list = [] for person in load[house]['people']: for lista in tipo: print(lista[0], load[house]['people'][person]) if lista[0] == load[house]['people'][person]: people_list.append(Person(lista)) break h = House(area,people_list,arg[1]) h.sell = load[house]['sell'] h.buy = load[house]['buy'] update_price(h.sell,h.buy,h.token) house_list.append(h) com = Community(arg[1],house_list) time_interval = str(isodate.parse_duration(community_times['0']['Period'])).split(':') time_interval = (int(time_interval[0])*60 + int(time_interval[1]))*60 year = 31536000 read_interval = int(arg[3]) x = int(arg[2])*60 time_2_send = (read_interval*x)/year #print(time_2_send) time1 = 0 skip_flag = False house_dict = {} socket_list = [] #url = 'http://localhost:6379' url = 'http://13.84.134.143:6379' for a in com.houses: sio = socketio.Client() sio.connect(url,headers= {'authorization': a.token},namespaces=['/measures']) socket_list.append(sio) print(sio.sid) if a not in house_dict: house_dict[a] = [] while True: time1 = time.time() timestamp = dp.parse(community_times['0']['PeriodStart']).timestamp() end_timestamp = timestamp for index in community_times: values = [] for a in com.houses: house_dict[a] = [] values.append(round(a.production(index) - a.consumption(index),3)) end_timestamp += time_interval while(timestamp < end_timestamp): skip_flag = True cont = 0 for a in com.houses: house_dict[a].append({'timestamp': timestamp, 'value': values[cont]}) cont+=1 time.sleep(time_2_send) timestamp += read_interval if skip_flag: skip_flag = False cont = 0 for a in com.houses: #print(len(house_dict[a])) socket_list[cont].emit('store-bulk',house_dict[a],namespace='/measures') cont += 1 print(datetime.fromtimestamp(timestamp)) #print(update(house_dict[a],a.token).json(), datetime.fromtimestamp(timestamp)) print(time.time() - time1) break for i in range(len(com.houses)): socket_list[i].disconnect()
bedroom1Rad = Rad(2500) bedroom1Light = Light(98) bedroom1Door = Door(1.5) electricBlanket = ElectricBlanket(5) bedroom1 = Bedroom("Bedroom 1", 12, 12, 8, 12.0, bedroom1Rad, bedroom1Door, bedroom1Light, bedroom1Window, electricBlanket) utilityRoomWindow = Window(3) utilityRoomRad = Rad(1200) utiilityRoomLight = Light(100) utilityRoomDoor = Door(2) dryer = Dryer(300) utiilityRoom = UtilityRoom("Utility Room", 8, 8, 8, 12.0, \ utilityRoomRad, utilityRoomDoor, utiilityRoomLight, utilityRoomWindow, dryer) houseRooms = [livingRoom, kitchen, bedroom1, utiilityRoom] houseRads = [livingRoomRad, kitchenRad, bedroom1Rad, utilityRoomRad] houseLights = [livingRoomLight, kitchenLight, bedroom1Light, utiilityRoomLight] Boiler = Heater(houseRads) Light_Controller = LightController(houseLights) Kitchen_Controller = KitchenController(kitchen) Bedroom_Controller = BedroomController(bedroom1) Utility_Room_Controller = UtilityRoomController(utiilityRoom) Home = House(True, houseRooms, Boiler, "-37.8136", "144.9631") Mon = Monitor(0, 30, Boiler, Light_Controller, Kitchen_Controller, Bedroom_Controller, Utility_Room_Controller) c = Controller(Home, Mon) c.run()
self.commands.takeC(Input) if Input[0] == "release" and len(Input) > 1: self.commands.releaseC(Input) if Input[0] == "unlock" and len(Input) > 1: print(self.commands.unlockC(Input)) if Input[0] == "show" and len(Input) == 1: print(self.commands.showC(Input)) if Input[0] == "commands" and len(Input) == 1: print(self.commands.commandsC(Input)) if Input[0] == "holding" and len(Input) == 1: self.commands.holdingC(Input) if Input[0] == "read" and len(Input) > 1: print(self.commands.readC(Input)) if Input[0] == "open" and len(Input) > 1: print(self.commands.openC(Input)) if Input[0] == "quit" and len(Input) == 1: print(self.commands.quitC(Input)) ##START GAME## GameInstance = Game(House(sys.argv[1]), Player(), Commands())