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