def set_display_hint(self): """ set the display hint above the agent's head (toggled with F2) """ display_hint = constants.getDisplayHint() if display_hint: if display_hint == 'fitness': self.state.label = '%.2g' % self.fitness[0] elif display_hint == 'time alive': self.state.label = str(self.step) elif display_hint == 'hit points': self.state.label = ''.join('.' for i in range( int(5 * OpenNero.get_environment().get_hitpoints(self)))) elif display_hint == 'id': self.state.label = str(self.state.id) elif display_hint == 'species id': self.state.label = 'q' elif display_hint == 'debug': self.state.label = str( OpenNero.get_environment().get_state(self)) else: self.state.label = '?' else: # the first time we switch away from displaying stuff, # change the window caption if self.state.label: self.state.label = ""
def set_display_hint(self): """ set the display hint above the agent's head (toggled with F2) """ display_hint = constants.getDisplayHint() if display_hint: if display_hint == 'fitness': self.state.label = '%.2f' % self.org.fitness elif display_hint == 'time alive': self.state.label = str(self.org.time_alive) elif display_hint == 'hit points': self.state.label = ''.join('.' for i in range(int(5*OpenNero.get_environment().get_hitpoints(self)))) elif display_hint == 'id': self.state.label = str(self.org.genome.id) elif display_hint == 'champion': if self.org.champion: self.state.label = 'champ!' else: self.state.label = '' elif display_hint == 'rank': self.state.label = str(self.org.rank) elif display_hint == 'debug': self.state.label = str(OpenNero.get_environment().get_state(self)) else: self.state.label = '?' else: # the first time we switch away from displaying stuff, # change the window caption if self.state.label: self.state.label = ""
def set_display_hint(self): """ set the display hint above the agent's head (toggled with F2) """ display_hint = constants.getDisplayHint() if display_hint: org = self.get_org() if display_hint == 'fitness': self.state.label = '%.2f' % org.fitness elif display_hint == 'time alive': self.state.label = str(org.time_alive) elif display_hint == 'hit points': self.state.label = ''.join('.' for i in range( int(5 * OpenNero.get_environment().get_hitpoints(self)))) elif display_hint == 'id': self.state.label = str(org.id) elif display_hint == 'species id': self.state.label = str(org.species_id) elif display_hint == 'champion': if org.champion: self.state.label = 'champ!' else: self.state.label = '' elif display_hint == 'rank': self.state.label = str(org.rank) elif display_hint == 'debug': self.state.label = str( OpenNero.get_environment().get_state(self)) else: self.state.label = '?' else: # the first time we switch away from displaying stuff, # change the window caption if self.state.label: self.state.label = ""