diff --git a/pelita/game.py b/pelita/game.py index 6cbacc56..efc51f3a 100644 --- a/pelita/game.py +++ b/pelita/game.py @@ -555,7 +555,8 @@ def prepare_bot_state(game_state, idx=None): 'bot_was_killed': game_state['bot_was_killed'][own_team::2], 'error_count': len(game_state['errors'][own_team]), 'food': list(game_state['food'][own_team]), - 'name': game_state['team_names'][own_team] + 'name': game_state['team_names'][own_team], + 'team_time': game_state['team_time'][own_team] } enemy_state = { @@ -568,7 +569,8 @@ def prepare_bot_state(game_state, idx=None): 'bot_was_killed': game_state['bot_was_killed'][enemy_team::2], 'error_count': 0, # TODO. Could be left out for the enemy 'food': list(game_state['food'][enemy_team]), - 'name': game_state['team_names'][enemy_team] + 'name': game_state['team_names'][enemy_team], + 'team_time': game_state['team_time'][enemy_team] } bot_state = { diff --git a/pelita/team.py b/pelita/team.py index dab0930c..042a67f2 100644 --- a/pelita/team.py +++ b/pelita/team.py @@ -524,9 +524,11 @@ class Bot: team_name, error_count, is_noisy, - bot_turn=None): + bot_turn=None, + team_time=None): self._bots = None self._say = None + self._team_time = team_time if team_time is not None else 0 #: The previous positions of this bot including the current one. self.track = [] @@ -602,6 +604,11 @@ class Bot: """ Print some text in the graphical interface. """ self._say = text + @property + def team_time(self): + """ The cumulative time for the team shown in the GUI. """ + return self._team_time + # def get_direction(self, position): # """ Return the direction needed to get to the given position. @@ -745,7 +752,8 @@ def make_bots(*, walls, shape, initial_positions, homezone, team, enemy, round, initial_position=team_initial_positions[idx], is_blue=team_index % 2 == 0, homezone=homezone[team_index], - team_name=team['name']) + team_name=team['name'], + team_time=team.get('team_time', 0)) b._bots = bots team_bots.append(b) @@ -770,7 +778,8 @@ def make_bots(*, walls, shape, initial_positions, homezone, team, enemy, round, initial_position=enemy_initial_positions[idx], is_blue=enemy_index % 2 == 0, homezone=homezone[enemy_index], - team_name=enemy['name']) + team_name=enemy['name'], + team_time=enemy.get('team_time', 0)) b._bots = bots enemy_bots.append(b)