Skip to content

Commit

Permalink
Updated config to allow math and engine to switch teams appropriately.
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanAEckelberg committed Jan 28, 2024
1 parent 600dfcd commit d2d9474
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions game/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"random",
"heapq",
"sympy",
"math",
]

RESULTS_FILE_NAME = "results.json" # Name and extension of results file
Expand Down
7 changes: 4 additions & 3 deletions game/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ def boot(self):
finally:
# Note: I keep the above thread for both naming conventions to check for client errors
try:
if self.use_filenames:
player.file_name = filename
player.file_name = filename
player.team_name = thr.retrieve_value()
except Exception as e:
player.functional = False
Expand All @@ -142,7 +141,7 @@ def boot(self):
self.shutdown(source='Client_error')
else:
# Sort clients based on name, for the client runner
self.clients.sort(key=lambda clnt: clnt.team_name, reverse=True)
self.clients.sort(key=lambda clnt: clnt.file_name, reverse=True)
# Finally, request master controller to establish clients with basic objects
if SET_NUMBER_OF_CLIENTS_START == 1:
self.master_controller.give_clients_objects(self.clients[0], self.world)
Expand Down Expand Up @@ -201,6 +200,8 @@ def tick(self):

# Time and wait for clients to be done
start_time = datetime.now()


for thr in threads:
# We only want to wait a maximum of MAX_SECONDS_PER_TURN once all of the clients have started.
# However, we can't simultaneously join threads without more threads or multiprocessing.
Expand Down

0 comments on commit d2d9474

Please sign in to comment.