def test_temp(yy,xx,place): nw=Rect(Point(0,0),Point(CITY_SIZE_X/2,CITY_SIZE_Y/2)) ne=Rect(Point(CITY_SIZE_X/2,0),Point(CITY_SIZE_X,CITY_SIZE_Y/2)) sw=Rect(Point(0,CITY_SIZE_Y/2),Point(CITY_SIZE_X/2,CITY_SIZE_Y)) se=Rect(Point(CITY_SIZE_X/2,CITY_SIZE_Y/2),Point(CITY_SIZE_X,CITY_SIZE_Y)) if(xx==0)and(yy==0): if(not nw.overlaps(place)): print('errore micidiale 1'); if(xx==0)and(yy==1): if(not ne.overlaps(place)): print('errore micidiale 2'); if(xx==1)and(yy==0): if(not sw.overlaps(place)): print('errore micidiale 3'); if(xx==1)and(yy==1): if(not se.overlaps(place)): print('errore micidiale 4');
def test_temp(yy, xx, place): nw = Rect(Point(0, 0), Point(CITY_SIZE_X / 2, CITY_SIZE_Y / 2)) ne = Rect(Point(CITY_SIZE_X / 2, 0), Point(CITY_SIZE_X, CITY_SIZE_Y / 2)) sw = Rect(Point(0, CITY_SIZE_Y / 2), Point(CITY_SIZE_X / 2, CITY_SIZE_Y)) se = Rect(Point(CITY_SIZE_X / 2, CITY_SIZE_Y / 2), Point(CITY_SIZE_X, CITY_SIZE_Y)) if (xx == 0) and (yy == 0): if (not nw.overlaps(place)): print('errore micidiale 1') if (xx == 0) and (yy == 1): if (not ne.overlaps(place)): print('errore micidiale 2') if (xx == 1) and (yy == 0): if (not sw.overlaps(place)): print('errore micidiale 3') if (xx == 1) and (yy == 1): if (not se.overlaps(place)): print('errore micidiale 4')
def test_temp(yy,xx,place): CX=config['CITY_SIZE_X'] CY=config['CITY_SIZE_Y'] # Make 4 rectangles, one for each qudrant nw=Rect(Point(0,0), Point(CX//2, CY//2)) ne=Rect(Point(CX//2,0), Point(CX//2,CY//2)) sw=Rect(Point(0,CY//2), Point(CX//2,CY)) se=Rect(Point(CX//2,CY//2), Point(CX,CY)) if(xx==0)and(yy==0): if(not nw.overlaps(place)): return 1 if(xx==0)and(yy==1): if(not ne.overlaps(place)): return 2 if(xx==1)and(yy==0): if(not sw.overlaps(place)): return 3 if(xx==1)and(yy==1): if(not se.overlaps(place)): return 4 return False
def test_temp(yy, xx, place): CX = config['CITY_SIZE_X'] CY = config['CITY_SIZE_Y'] # Make 4 rectangles, one for each qudrant nw = Rect(Point(0, 0), Point(CX // 2, CY // 2)) ne = Rect(Point(CX // 2, 0), Point(CX // 2, CY // 2)) sw = Rect(Point(0, CY // 2), Point(CX // 2, CY)) se = Rect(Point(CX // 2, CY // 2), Point(CX, CY)) if (xx == 0) and (yy == 0): if (not nw.overlaps(place)): return 1 if (xx == 0) and (yy == 1): if (not ne.overlaps(place)): return 2 if (xx == 1) and (yy == 0): if (not sw.overlaps(place)): return 3 if (xx == 1) and (yy == 1): if (not se.overlaps(place)): return 4 return False
#CREAZIONE EDIFICI RURALI for i in range(0,len(PLACESN)): #place=createPlacePoint(Point(int(CITY_SIZE_X/2),int(CITY_SIZE_Y/2))) #if(defaultPlace[PLACES[i]][2]=='rural') or (defaultPlace[PLACES[i]][2]=='free'): place=createPlaceDefault(Point(int(CITY_SIZE_X/2),int(CITY_SIZE_Y/2)),PLACESN[i]) place.set_name(PLACESN[i]) buildings.append(place) buildings=generaPlace(buildings,new_town) buildings=mappa_zone(buildings) print('Controllo conflitti natura') for place in list(buildings): for n in list(nature): if(place.overlaps(n)): if(defaultResurce[n.name][1]=='removable'): nature.remove(n) else: if(place.name=='HOUSE'): try: buildings.remove(place) except ValueError as e: pass else: print('muovo a nord '+place.name+' di : '+str(n.top-place.top)) place.move(1,n.top-place.top) for place in list(buildings): for place2 in list(buildings): if(not (id(place)==id(place2))):
for i in range(0, len(PLACESN)): #place=createPlacePoint(Point(int(CITY_SIZE_X/2),int(CITY_SIZE_Y/2))) #if(defaultPlace[PLACES[i]][2]=='rural') or (defaultPlace[PLACES[i]][2]=='free'): place = createPlaceDefault( Point(int(CITY_SIZE_X / 2), int(CITY_SIZE_Y / 2)), PLACESN[i]) place.set_name(PLACESN[i]) buildings.append(place) buildings = generaPlace(buildings, new_town) buildings = mappa_zone(buildings) print('Controllo conflitti natura') for place in list(buildings): for n in list(nature): if (place.overlaps(n)): if (defaultResurce[n.name][1] == 'removable'): nature.remove(n) else: if (place.name == 'HOUSE'): try: buildings.remove(place) except ValueError as e: pass else: print('muovo a nord ' + place.name + ' di : ' + str(n.top - place.top)) place.move(1, n.top - place.top) for place in list(buildings): for place2 in list(buildings):