Example #1
0
    for i1,i2 in d:
        mtx[i1,i2] = 1
        mtx[i2,i1] = 1

    for i in range(256):
        mtx[i,i] = 1
    return mtx

def show_nonlinear(d):
    print ("Linear automata are:", list(sorted(linear_automata)))
    noticed = set()
    for i1,i2 in d:
        if i1 == 0 or i2 == 255: continue
        if i1 in shift_automata or i2 in shift_automata: continue
        if i1 not in linear_automata or i2 not in linear_automata:
            print (i1, i2)
            noticed.add(i1)
            noticed.add(i2)
    print ("All noticed automata:", list(sorted(noticed)))

if __name__=="__main__":
    d = load_data("time2d_compatible_automata.csv")

    #show_nonlinear(d)

    pp.matshow(as_matrix(d))
    pp.show()
    

    
from matplotlib import pyplot as pp
from collections import Counter
import json

from elementary_ca import is_linear, index2table, is_additive, table2index, mirror_ca
from time2d_ca import load_data
import os.path


mapped = dict()

all_pairs = set()

for a, b in load_data("time2d_compatible_automata.csv"):
    all_pairs.add((a,b))
    all_pairs.add((b,a))
    akey = "%x"%a
    bkey = "%x"%b
    try:
        a_rules = mapped[akey]
    except KeyError:
        a_rules = dict()
        mapped[akey] = a_rules
    a_rules[bkey] = 1


rule_props = dict()

byNumberOfDuals = Counter()
for rule in range(256):
    rtable = index2table(rule)