Ejemplo n.º 1
0
 def __init__(self, agent, simLogic):
     ComplexAction.__init__(self)
     self._simLogic = simLogic
     migrationDestination = agent.getMigrationDestination()
     if migrationDestination is None:
         return
     agentsToMigrate = self._getAgentsToMigrate(agent)
     for agentToMigrate in agentsToMigrate:
         self.addAction(RemoveAgentAction(agent, agentToMigrate))
         self.addAction(AddAgentAction(migrationDestination, agentToMigrate))
Ejemplo n.º 2
0
 def __init__(self, agent, simLogic):
     ComplexAction.__init__(self)
     
     self._stats["agent"] = agent
     
     if not agent.wantToMeet():
         self._stats["wantMeet"] = False
         return
     
     self._stats["wantMeet"] = True
     
     self._simLogic = simLogic
     
     self._stats["duringMeeting"] = False
     
     if agent.isDuringMeeting():
         self._stats["duringMeeting"] = True
         self._stats["duringMeetingAgent"] = agent
         return
     
     meetingAgent = agent.meetAgent()
     
     self._stats["noAgentToMeet"] = False
     
     self._stats["agentsSimilarity"] = None
     
     if meetingAgent is None:
         self._stats["noAgentToMeet"] = True
         return
     
     if meetingAgent.isDuringMeeting():
         return
     
     if agent.wantToReproduce() is None:
         return
     
     agent.setAgentMeeting(True)
     meetingAgent.setAgentMeeting(True)
     
     self._stats["agents"] = [agent, meetingAgent]
     
     if agent.wantToReproduce() and meetingAgent.wantToReproduce():
         self._stats["action"] = "reproduce"
         self._stats["agentsSimilarity"] = agent.cosinus(meetingAgent)
         self.reproduce(agent, meetingAgent)
     else:
         self._stats["action"] = "fight"
         self.fight(agent, meetingAgent)
     self._changeAddittionalInfo(agent,1)