fix except traceback, var name,
This commit is contained in:
parent
b473ec9172
commit
59bcb0ccc5
10
main.py
10
main.py
@ -3,13 +3,14 @@ import time
|
|||||||
import sys
|
import sys
|
||||||
from sys import exit
|
from sys import exit
|
||||||
from game_layer import GameLayer
|
from game_layer import GameLayer
|
||||||
|
import traceback
|
||||||
|
|
||||||
api_key = "74e3998d-ed3d-4d46-9ea8-6aab2efd8ae3"
|
api_key = "74e3998d-ed3d-4d46-9ea8-6aab2efd8ae3"
|
||||||
# The different map names can be found on considition.com/rules
|
# The different map names can be found on considition.com/rules
|
||||||
map_name = "training1" # TODO: You map choice here. If left empty, the map "training1" will be selected.
|
map_name = "training1" # TODO: You map choice here. If left empty, the map "training1" will be selected.
|
||||||
|
|
||||||
game_layer = GameLayer(api_key)
|
game_layer = GameLayer(api_key)
|
||||||
useTestStrategy = False
|
usePrebuiltStrategy = False
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -23,8 +24,7 @@ def main():
|
|||||||
try:
|
try:
|
||||||
take_turn()
|
take_turn()
|
||||||
except:
|
except:
|
||||||
e = sys.exc_info()[0]
|
print(traceback.format_exc())
|
||||||
print(e)
|
|
||||||
game_layer.end_game()
|
game_layer.end_game()
|
||||||
exit()
|
exit()
|
||||||
time_diff = time.time() - start_time
|
time_diff = time.time() - start_time
|
||||||
@ -40,7 +40,7 @@ def take_turn():
|
|||||||
# TODO Implement your artificial intelligence here.
|
# TODO Implement your artificial intelligence here.
|
||||||
# TODO Take one action per turn until the game ends.
|
# TODO Take one action per turn until the game ends.
|
||||||
# TODO The following is a short example of how to use the StarterKit
|
# TODO The following is a short example of how to use the StarterKit
|
||||||
if not useTestStrategy:
|
if not usePrebuiltStrategy:
|
||||||
state = game_layer.game_state
|
state = game_layer.game_state
|
||||||
print("testrunda")
|
print("testrunda")
|
||||||
# messages and errors for console log
|
# messages and errors for console log
|
||||||
@ -53,7 +53,7 @@ def take_turn():
|
|||||||
# pre-made test strategy
|
# pre-made test strategy
|
||||||
# which came with
|
# which came with
|
||||||
# starter kit
|
# starter kit
|
||||||
if useTestStrategy:
|
if usePrebuiltStrategy:
|
||||||
state = game_layer.game_state
|
state = game_layer.game_state
|
||||||
if len(state.residences) < 1:
|
if len(state.residences) < 1:
|
||||||
for i in range(len(state.map)):
|
for i in range(len(state.map)):
|
||||||
|
Reference in New Issue
Block a user