def test_compare_evil_random_pure(self): rule_a = 30 rule_b = 184 rando = ZerosThenOnesRandom(1001) compu = cagen.DualRuleCellularAutomaton(rule_a, rule_b, 0.5) sf = cagen.automatic_stepfunc(size=(100,), computation=compu, needs_random_generator=True, random_generator=rando, histogram=True) sf.gen_code() simu = CagenSimulator(sf) br = cagen.BinRule(rule=rule_a, config=simu.get_config()) for i in range(10): simu.step_pure_py() br.step_pure_py() assert_arrays_equal(simu.get_config(), br.get_config()) br2 = cagen.BinRule(rule=rule_b, config=simu.get_config()) for i in range(19): simu.step_pure_py() br2.step_pure_py() assert_arrays_equal(simu.get_config(), br2.get_config())
def test_compare_nondeterministic_weave(self): compu = cagen.DualRuleCellularAutomaton(184, 232, 1) sf = cagen.automatic_stepfunc(size=(100,), computation=compu, needs_random_generator=True, histogram=True) sf.gen_code() simu = CagenSimulator(sf) br = cagen.BinRule(rule=184, config=simu.get_config()) for i in range(50): simu.step_inline() br.step_inline() assert_arrays_equal(simu.get_config(), br.get_config())