Feb-22-2017, 02:03 AM
numbers = {'***': 128, '** ': 64, '* *': 32, '* ': 16, ' **': 8, ' * ': 4, ' *': 2, ' ': 1} def eca(rule, n = 18, start = '*'): rule_bin = reversed(bin(rule)[2:]) last = start for generation in range(n): print(last) last = ' {} '.format(last) next = '' for index in range(len(last) - 2): if rule & numbers[last[index:index + 3]]: next += '*' else: next += ' ' last = next eca(18)
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures