Skip to content

Commit

Permalink
Fix EvoLife example for genome crossover (#44, #36)
Browse files Browse the repository at this point in the history
  • Loading branch information
a5kin committed Mar 17, 2019
1 parent fb6aa00 commit d2632f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/evolife.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def absorb(self):
genomes = [core.IntegerVariable() for _ in range(len(self.buffers))]
for i in range(len(self.buffers)):
genomes[i] = self.neighbors[i].buffer.rule * (fitnesses[i] > 0)
self.main.rule = genome_crossover(*genomes)
num_genes = self.main.rule.bit_width
self.main.rule = genome_crossover(self.main, num_genes, *genomes)

@color_effects.MovingAverage
def color(self):
Expand All @@ -99,7 +100,7 @@ class BigBangExperiment(RegularExperiment):
pos=(320, 180),
size=(100, 100),
vals={
"energy": RandInt(0, 1) * RandInt(1, 255),
"energy": RandInt(0, 1),
"rule": RandInt(0, 2 ** 17 - 1),
"rng": RandInt(0, 2 ** 16 - 1)
}
Expand Down

0 comments on commit d2632f7

Please sign in to comment.