comparison CircularCA.py @ 43:6cd37534c12e

Chapter 6, exercise 3: exploring rule 110 cellular automata.
author Brian Neal <bgneal@gmail.com>
date Mon, 14 Jan 2013 20:41:41 -0600
parents 039249efe42f
children
comparison
equal deleted inserted replaced
42:039249efe42f 43:6cd37534c12e
30 self.array = numpy.zeros((n, self.m), dtype=numpy.int8) 30 self.array = numpy.zeros((n, self.m), dtype=numpy.int8)
31 self.next = 0 31 self.next = 0
32 32
33 def start_single(self): 33 def start_single(self):
34 self.array[0, 1] = 1 34 self.array[0, 1] = 1
35 self.next = 1
36
37 def start_row(self, row):
38 """Set the first row to row and set next to 1."""
39 self.array[0, :] = row
35 self.next = 1 40 self.next = 1
36 41
37 def step(self): 42 def step(self):
38 """Executes one time step by computing the next row of the array.""" 43 """Executes one time step by computing the next row of the array."""
39 i = self.next 44 i = self.next