Esempio n. 1
0
 def TerminateProcess(self, emotion, successful=True):
     if self.actualProcess == None:
         self.actualIntention = None #there is no process left - HL intention finnished
         return
     
     self.actualProcess.TerminateProcess(successful)
     #commented in original: self.episodicMemory.StoreProcess(self.actualProcess, emotion)
     
     if not successful:
         # actual process went wrong, next step AS will select another in parent intention
         self.actualProcess = self.actualProcess.parent
     else:
         # actual process finnished, parent intention as well
         self.actualProcess = self.actualProcess.parent
             
         if self.actualProcess != None:
             notFinishedIntentions = Global.SetDifference(self.actualProcess.process.intentions, self.actualProcess.completedIntentions) 
             if len(notFinishedIntentions) == 0:
                 self.TerminateProcess(True)
             else:
                 # this would be otherwise called in AS next step via AS.ChooseProcessForIntention but randomly 
                 self.ActivateIntention(notFinishedIntentions[0], self.actualProcess)
         else:
             #there is no process left - HL intention finnished
             self.actualIntention = None
Esempio n. 2
0
 def ChooseProcessForIntention(self, emotion, intention, parentProcess):
     processes = intention.processes
     if parentProcess != None:
         processes = Global.SetDifference(processes, parentProcess.failedProcesses)
         
     if len(processes) == 0:
         return None
     if intention.name == "Want":    #for Want intention the order of process matters
         return processes[0]
     else:
         return Global.Choice(processes)