Skip to content
Snippets Groups Projects
Commit 580f670d authored by Daniel Axtens's avatar Daniel Axtens
Browse files

option to cap number of agents

parent 99e58b5b
No related merge requests found
......@@ -153,12 +153,13 @@ class Supervisor:
@Debug
def SpawnAgent (self, agent):
child = agent.__class__ ()
self.population.append (child)
agent.Reproduced ()
stat = self.agentStats [str(agent.__class__)]
stat [0] += 1
stat [1] += 1
if MAX_TOTAL_AGENTS > 0 and len(self.population) - len(self.pendingDeaths) < MAX_TOTAL_AGENTS:
child = agent.__class__ ()
self.population.append (child)
agent.Reproduced ()
stat = self.agentStats [str(agent.__class__)]
stat [0] += 1
stat [1] += 1
def Select (self):
# This approach causes agents to keep fighting until they've either died or reproduced.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment