flytta upp dev society & need attention i koden
This commit is contained in:
parent
0833b843a3
commit
143a5dbecf
72
main.py
72
main.py
@ -194,42 +194,6 @@ def take_turn():
|
|||||||
for error in game_layer.game_state.errors:
|
for error in game_layer.game_state.errors:
|
||||||
print("Error: " + error)
|
print("Error: " + error)
|
||||||
|
|
||||||
|
|
||||||
def chartMap():
|
|
||||||
state = game_layer.game_state
|
|
||||||
for x in range(len(state.map) - 1):
|
|
||||||
for y in range(len(state.map) - 1):
|
|
||||||
if state.map[x][y] == 0:
|
|
||||||
availableTiles.append((x, y))
|
|
||||||
optimizeAvailableTiles()
|
|
||||||
|
|
||||||
def adjustEnergy(currentBuilding):
|
|
||||||
global rounds_between_energy
|
|
||||||
global EMA_temp
|
|
||||||
blueprint = game_layer.get_residence_blueprint(currentBuilding.building_name)
|
|
||||||
outDoorTemp = game_layer.game_state.current_temp * 2 - EMA_temp
|
|
||||||
|
|
||||||
temp_acceleration = (2*(21 - currentBuilding.temperature)/(rounds_between_energy))
|
|
||||||
|
|
||||||
effectiveEnergyIn = ((temp_acceleration - 0.04 * currentBuilding.current_pop + (currentBuilding.temperature - outDoorTemp) * blueprint.emissivity) / 0.75) + blueprint.base_energy_need
|
|
||||||
|
|
||||||
if effectiveEnergyIn > blueprint.base_energy_need:
|
|
||||||
game_layer.adjust_energy_level((currentBuilding.X, currentBuilding.Y), effectiveEnergyIn)
|
|
||||||
elif effectiveEnergyIn < blueprint.base_energy_need:
|
|
||||||
game_layer.adjust_energy_level((currentBuilding.X, currentBuilding.Y), blueprint.base_energy_need + 0.01)
|
|
||||||
else:
|
|
||||||
print("you did it!")
|
|
||||||
game_layer.wait()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def optimizeAvailableTiles():
|
|
||||||
#hitta #utilities antal bästa platser i mitten av smeten och sätt de först, sätt allt runt dem i ordning så närmast är längst fram i listan
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def something_needs_attention():
|
def something_needs_attention():
|
||||||
print("Checking for emergencies")
|
print("Checking for emergencies")
|
||||||
global building_under_construction
|
global building_under_construction
|
||||||
@ -279,6 +243,42 @@ def develop_society():
|
|||||||
else:
|
else:
|
||||||
game_layer.wait()
|
game_layer.wait()
|
||||||
|
|
||||||
|
def chartMap():
|
||||||
|
state = game_layer.game_state
|
||||||
|
for x in range(len(state.map) - 1):
|
||||||
|
for y in range(len(state.map) - 1):
|
||||||
|
if state.map[x][y] == 0:
|
||||||
|
availableTiles.append((x, y))
|
||||||
|
optimizeAvailableTiles()
|
||||||
|
|
||||||
|
def adjustEnergy(currentBuilding):
|
||||||
|
global rounds_between_energy
|
||||||
|
global EMA_temp
|
||||||
|
blueprint = game_layer.get_residence_blueprint(currentBuilding.building_name)
|
||||||
|
outDoorTemp = game_layer.game_state.current_temp * 2 - EMA_temp
|
||||||
|
|
||||||
|
temp_acceleration = (2*(21 - currentBuilding.temperature)/(rounds_between_energy))
|
||||||
|
|
||||||
|
effectiveEnergyIn = ((temp_acceleration - 0.04 * currentBuilding.current_pop + (currentBuilding.temperature - outDoorTemp) * blueprint.emissivity) / 0.75) + blueprint.base_energy_need
|
||||||
|
|
||||||
|
if effectiveEnergyIn > blueprint.base_energy_need:
|
||||||
|
game_layer.adjust_energy_level((currentBuilding.X, currentBuilding.Y), effectiveEnergyIn)
|
||||||
|
elif effectiveEnergyIn < blueprint.base_energy_need:
|
||||||
|
game_layer.adjust_energy_level((currentBuilding.X, currentBuilding.Y), blueprint.base_energy_need + 0.01)
|
||||||
|
else:
|
||||||
|
print("you did it!")
|
||||||
|
game_layer.wait()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def optimizeAvailableTiles():
|
||||||
|
#hitta #utilities antal bästa platser i mitten av smeten och sätt de först, sätt allt runt dem i ordning så närmast är längst fram i listan
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def build(structure):
|
def build(structure):
|
||||||
print("Building " + structure)
|
print("Building " + structure)
|
||||||
state = game_layer.game_state
|
state = game_layer.game_state
|
||||||
|
Reference in New Issue
Block a user