zasim.cagen.dualrule - Using two elementary rules at once

Inheritance diagram of zasim.cagen.dualrule

See also

tutorial_zasim_in_gui discusses these and shows how a little gui gadget can be programmed to play around with different rules, probabilities and starting configurations.

class zasim.cagen.dualrule.DualRuleCellularAutomaton(rule_a=None, rule_b=None, alpha=0.5, **kwargs)[source]

Bases: zasim.cagen.bases.Computation

For two given rules and a probability, this computation executes either rule_a (with alpha as probability) or rule_b.

Everything else works just like the ElementaryCellularAutomatonBase.

Create the computation.

Supply None as either rule to get a random one.

digits_and_values = []

This list stores a list of dictionaries that for each combination of values for the neighbourhood cells stores the result_value, too.

The result_value field is a tuple of what value to use with alpha and what value to use with 1-alpha probability.

requires_features = ['random_generator']
rule_a = 0

The elementary rule to use with probability alpha.

rule_b = 0

The elementary rule to use with probability 1 - alpha.

alpha = 0.5

The probability for which to use rule_a rather than rule_b.


Get the rule_a’th and rule_b’th cellular automaton for the given neighbourhood.

For a more detailled description of how this works, see ElementaryCellularAutomatonBase.visit.


Add the RULE_ALPHA constant to the stepfunc object.


Generate the rule lookup arrays and a pretty printer.


This method is generated upon init_once and pretty-prints the rules that this elementary cellular automaton uses for local steps.


Previous topic


Next topic

zasim.cagen.stats - Statistics gatherers

This Page