def test_cis_manipulation(c_one_unit): net = c_one_unit.create_network() cis = net.genes[0].modules[0] for i in range(16): op = T.Operand(i) print op cis.op = op for a, b in ((0, 0), (0, 1), (1, 0), (1, 1)): assert operand.calculate(op, a, b) == cis.test(a, b)
def network_cycle(network, curstate): """A Python version of what the C++ cycle does.""" nextstate = Channels(network.factory.world) for g in network.genes: for m in g.modules: a, b = m.channels if operand.calculate(m.op, curstate.test(a), curstate.test(b)): nextstate.set(g.pub) break return nextstate