Finished profiling
parent
bde75c012e
commit
2f844b2b12
|
@ -17,4 +17,4 @@ if __name__ == '__main__':
|
||||||
p = u.CAMParser('B3/S23', c)
|
p = u.CAMParser('B3/S23', c)
|
||||||
|
|
||||||
c.randomize()
|
c.randomize()
|
||||||
c.start_plot(100, p.ruleset)
|
c.start_plot(200, p.ruleset)
|
||||||
|
|
|
@ -91,12 +91,12 @@ class CAM:
|
||||||
ax.get_xaxis().set_visible(False)
|
ax.get_xaxis().set_visible(False)
|
||||||
ax.get_yaxis().set_visible(False)
|
ax.get_yaxis().set_visible(False)
|
||||||
|
|
||||||
mshown = plt.matshow(self.master, fig.number)
|
mshown = plt.matshow(self.master, fig.number, cmap='Greys')
|
||||||
|
|
||||||
def animate(frame):
|
def animate(frame):
|
||||||
self.tick(rules, *args)
|
self.tick(rules, *args)
|
||||||
mshown.set_array(self.master)
|
mshown.set_array(self.master)
|
||||||
fig.canvas.draw()
|
return [mshown]
|
||||||
|
|
||||||
ani.FuncAnimation(fig, animate, interval=clock)
|
ani.FuncAnimation(fig, animate, interval=clock)
|
||||||
plt.axis('off')
|
plt.axis('off')
|
||||||
|
|
|
@ -176,7 +176,6 @@ class Ruleset:
|
||||||
for config in self.configurations:
|
for config in self.configurations:
|
||||||
|
|
||||||
# Determine the correct function to use
|
# Determine the correct function to use
|
||||||
vfunc = None
|
|
||||||
if self.method == Ruleset.Method.MATCH:
|
if self.method == Ruleset.Method.MATCH:
|
||||||
vfunc = self._matches
|
vfunc = self._matches
|
||||||
elif self.method == Ruleset.Method.TOLERATE:
|
elif self.method == Ruleset.Method.TOLERATE:
|
||||||
|
@ -187,12 +186,9 @@ class Ruleset:
|
||||||
vfunc = lambda *args: True
|
vfunc = lambda *args: True
|
||||||
|
|
||||||
# Apply the function if possible
|
# Apply the function if possible
|
||||||
if vfunc is not None:
|
passed, state = config.passes(f_index, grid, vfunc, *args)
|
||||||
passed, state = config.passes(f_index, grid, vfunc, *args)
|
if passed:
|
||||||
if passed:
|
return state
|
||||||
return state
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
|
|
||||||
return grid.flat[f_index]
|
return grid.flat[f_index]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue