new: added new angry state (closes #486)
This commit is contained in:
parent
2f948306eb
commit
31a89cbe4b
@ -75,6 +75,15 @@ class Automata(object):
|
|||||||
logging.info("unit is grateful instead of sad")
|
logging.info("unit is grateful instead of sad")
|
||||||
self.set_grateful()
|
self.set_grateful()
|
||||||
|
|
||||||
|
def set_angry(self, factor):
|
||||||
|
if not self._has_support_network_for(factor):
|
||||||
|
logging.warning("%d epochs with no activity -> angry" % self._epoch.inactive_for)
|
||||||
|
self._view.on_angry()
|
||||||
|
plugins.on('angry', self)
|
||||||
|
else:
|
||||||
|
logging.info("unit is grateful instead of angry")
|
||||||
|
self.set_grateful()
|
||||||
|
|
||||||
def set_excited(self):
|
def set_excited(self):
|
||||||
logging.warning("%d epochs with activity -> excited" % self._epoch.active_for)
|
logging.warning("%d epochs with activity -> excited" % self._epoch.active_for)
|
||||||
self._view.on_excited()
|
self._view.on_excited()
|
||||||
@ -103,13 +112,21 @@ class Automata(object):
|
|||||||
|
|
||||||
self._epoch.next()
|
self._epoch.next()
|
||||||
|
|
||||||
# after X misses during an epoch, set the status to lonely
|
# after X misses during an epoch, set the status to lonely or angry
|
||||||
if was_stale:
|
if was_stale:
|
||||||
logging.warning("agent missed %d interactions -> lonely" % did_miss)
|
factor = did_miss / self._config['personality']['max_misses_for_recon']
|
||||||
self.set_lonely()
|
if factor >= 2.0:
|
||||||
# after X times being bored, the status is set to sad
|
self.set_angry(factor)
|
||||||
|
else:
|
||||||
|
logging.warning("agent missed %d interactions -> lonely" % did_miss)
|
||||||
|
self.set_lonely()
|
||||||
|
# after X times being bored, the status is set to sad or angry
|
||||||
elif self._epoch.inactive_for >= self._config['personality']['sad_num_epochs']:
|
elif self._epoch.inactive_for >= self._config['personality']['sad_num_epochs']:
|
||||||
self.set_sad()
|
factor = self._epoch.inactive_for / self._config['personality']['sad_num_epochs']
|
||||||
|
if factor >= 2.0:
|
||||||
|
self.set_angry(factor)
|
||||||
|
else:
|
||||||
|
self.set_sad()
|
||||||
# after X times being inactive, the status is set to bored
|
# after X times being inactive, the status is set to bored
|
||||||
elif self._epoch.inactive_for >= self._config['personality']['bored_num_epochs']:
|
elif self._epoch.inactive_for >= self._config['personality']['bored_num_epochs']:
|
||||||
self.set_bored()
|
self.set_bored()
|
||||||
|
@ -199,6 +199,7 @@ ui:
|
|||||||
smart: '(✜‿‿✜)'
|
smart: '(✜‿‿✜)'
|
||||||
lonely: '(ب__ب)'
|
lonely: '(ب__ب)'
|
||||||
sad: '(╥☁╥ )'
|
sad: '(╥☁╥ )'
|
||||||
|
angry: "(-_-')"
|
||||||
friend: '(♥‿‿♥)'
|
friend: '(♥‿‿♥)'
|
||||||
broken: '(☓‿‿☓)'
|
broken: '(☓‿‿☓)'
|
||||||
debug: '(#__#)'
|
debug: '(#__#)'
|
||||||
|
@ -16,6 +16,7 @@ DEMOTIVATED = '(≖__≖)'
|
|||||||
SMART = '(✜‿‿✜)'
|
SMART = '(✜‿‿✜)'
|
||||||
LONELY = '(ب__ب)'
|
LONELY = '(ب__ب)'
|
||||||
SAD = '(╥☁╥ )'
|
SAD = '(╥☁╥ )'
|
||||||
|
ANGRY = "(-_-')"
|
||||||
FRIEND = '(♥‿‿♥)'
|
FRIEND = '(♥‿‿♥)'
|
||||||
BROKEN = '(☓‿‿☓)'
|
BROKEN = '(☓‿‿☓)'
|
||||||
DEBUG = '(#__#)'
|
DEBUG = '(#__#)'
|
||||||
|
@ -284,6 +284,11 @@ class View(object):
|
|||||||
self.set('status', self._voice.on_sad())
|
self.set('status', self._voice.on_sad())
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
def on_angry(self):
|
||||||
|
self.set('face', faces.ANGRY)
|
||||||
|
self.set('status', self._voice.on_angry())
|
||||||
|
self.update()
|
||||||
|
|
||||||
def on_motivated(self, reward):
|
def on_motivated(self, reward):
|
||||||
self.set('face', faces.MOTIVATED)
|
self.set('face', faces.MOTIVATED)
|
||||||
self.set('status', self._voice.on_motivated(reward))
|
self.set('status', self._voice.on_motivated(reward))
|
||||||
|
@ -67,6 +67,13 @@ class Voice:
|
|||||||
self._('I\'m sad'),
|
self._('I\'m sad'),
|
||||||
'...'])
|
'...'])
|
||||||
|
|
||||||
|
def on_angry(self):
|
||||||
|
# passive aggressive or not? :D
|
||||||
|
return random.choice([
|
||||||
|
'...',
|
||||||
|
self._('Leave me alone ...'),
|
||||||
|
self._('I\'m mad at you!')])
|
||||||
|
|
||||||
def on_excited(self):
|
def on_excited(self):
|
||||||
return random.choice([
|
return random.choice([
|
||||||
self._('I\'m living the life!'),
|
self._('I\'m living the life!'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user