Ejemplo n.º 1
0
Archivo: worms.py Proyecto: cordoval/ca
from ca.base.generations import Generations
from ca.base.gui import play

class Worms(Generations):
    states = 6
    def birth(self):
        return self.live_count in [2, 5]
    def survival(self):
        return self.live_count in [3, 4, 6, 7]

play(Worms)



Ejemplo n.º 2
0
from ca.base.generations import Generations
from ca.base.gui import play


class StarWars(Generations):
    states = 4
    def birth(self):
        return self.live_count == 2
    def survival(self):
        return self.live_count in (3, 4, 5)

play(StarWars)

Ejemplo n.º 3
0
from ca.base.life import Life
from ca.base.gui import play

class ConwaysLife(Life):
    def birth(self):
        return self.live_count in [3]
    def survival(self):
        return self.live_count in [2, 3]

play(ConwaysLife)

Ejemplo n.º 4
0
from ca.base.generations import Generations
from ca.base.gui import play

class FireWorks(Generations):
    states= 21
    def birth(self):
        return self.live_count in [1, 3]
    def survival(self):
        return self.live_count in [2]

play(FireWorks)