random.seed ()
from rpsconst import *
-
-DEFAULT_HEALTH = 50
-REPRODUCE_HEALTH = 100
-DIE_HEALTH = 0
-MAX_AGE = 100
-
-DEBUG = True
-
-# Game dynamics - these are not final:
-# WINNER TRUTH ATTPoints, DEFPoints
-pointsTable [Attacker] [False] = (2, -2)
-pointsTable [Attacker] [True] = (2, -2)
-pointsTable [Defender] [False] = (-2, 2)
-pointsTable [Defender] [True] = (-2, 2)
-pointsTable [Tie] [False] = (0, 0)
-pointsTable [Tie] [True] = (1, 1)
+from conf import *
def Debug (f):
def g (*args):
@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.