Auto stash before merge of "linus" and "origin/felix-lek"

This commit is contained in:
linhara 2020-10-03 17:54:32 +02:00
parent 1fe1b01e78
commit c9c3cff598
2 changed files with 26 additions and 10 deletions

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

27
main.py
View File

@ -9,7 +9,7 @@ api_key = "74e3998d-ed3d-4d46-9ea8-6aab2efd8ae3"
map_name = "training1" # TODO: You map choice here. If left empty, the map "training1" will be selected.
game_layer = GameLayer(api_key)
useTestStrategy = False
useTestStrategy = True
def main():
@ -34,7 +34,28 @@ def main():
print("Done with game: " + game_layer.game_state.game_id)
print("Final score was: " + str(game_layer.get_score()["finalScore"]))
def linus_take_turn():
mylist = []
state = game_layer.game_state
for i in range(len(state.map)-1):
for j in range(len(state.map)-1):
if state.map[i][j] == 0:
mylist.append((i,j))
#print(mylist)
if (game_layer.game_state.turn == 0):
game_layer.place_foundation(mylist[0], game_layer.game_state.available_residence_buildings[0].building_name)
the_only_residence = state.residences[0]
if the_only_residence.build_progress < 100:
game_layer.build(mylist[0])
else:
# messages and errors for console log
game_layer.wait()
for message in game_layer.game_state.messages:
print(message)
for error in game_layer.game_state.errors:
print("Error: " + error)
def take_turn():
# TODO Implement your artificial intelligence here.
@ -90,6 +111,10 @@ def take_turn():
for error in game_layer.game_state.errors:
print("Error: " + error)
def available_ground():
if __name__ == "__main__":
main()