Package teamwork :: Package multiagent :: Module Historical
[hide private]
[frames] | no frames]

Source Code for Module teamwork.multiagent.Historical

 1  from PsychAgents import * 
 2   
3 -class HistoricalAgents(PsychAgents):
4 - def __init__(self):
5 self.history = []
6
7 - def getHistory(self):
8 try: 9 return self.history 10 except AttributeError: 11 self.history = [] 12 return self.history
13
14 - def microstep(self,turns=[],hypothetical=False,explain=False,suggest=False,debug=Debugger(0)):
15 previousState = self.getState().domain()[0].__copy__() 16 result = PsychAgents.microstep(self,turns,hypothetical,explain,suggest,debug) 17 18 #We only store the history if we're doing a real step 19 if not hypothetical: 20 action = result['decision'].values()[0][0] 21 self.getHistory().append({'action':action, 'previousState':previousState}) 22 23 return result
24