2 ms·
this should do the trick... while creatures: c = get_random_creature() if c.is_dead(): creatures.pop(c) else: creatures.add(c.mutate(
by sdenton4 2y ago
this should do the trick...
while creatures:
c = get_random_creature()
if c.is_dead():
creatures.pop(c)
else:
creatures.add(c.mutate())
- RogerL 2y agoYou also need selection, not just mutation (I know you are being silly, so am I)
- sdenton4 2y agoSelection is handled by asynchronous events which populate the is_dead() boolean. Critiquing my own code, though, it should really be a check against 'can_reproduce()' rather than 'is_dead()'.