Skip to content

Commit

Permalink
Fix win reason bug & remove indent log
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmdrz-mirdamadi committed Sep 19, 2022
1 parent 83d32ae commit 5d6aa9a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/process/GameHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ def check_finish(self):

if not (self.is_alive[2] or self.is_alive[3]):
print('Agents of player 2 destroyed!')
self.end_engine = True
self.winner = [1, 'Timeout']
if(self.end_engine):
self.winner[0] += randrange(2)
self.winner[1] += '/random'
self.winner = [randrange(1, 3), 'Timeout/random']
else:
self.end_engine = True
self.winner = [1, 'Timeout']

def update_info(self):
self.final_info['steps'].append({'players_data': [], 'map_data': {}})
Expand Down Expand Up @@ -174,7 +174,7 @@ def final_update_info(self):

def log_jsonify(self):
with open(f'{self.log_path}/game.json', 'w', encoding='utf8') as json_file:
dump(self.final_info, json_file, ensure_ascii=False, indent='\t')
dump(self.final_info, json_file, ensure_ascii=False)

def visualize(self):
if not self.visualizer:
Expand Down

0 comments on commit 5d6aa9a

Please sign in to comment.