r
/
fifth
1
Fork 0

Setup display examples

master
Joshua Potter 2015-06-17 21:04:59 -04:00
parent ff7de18508
commit a1737b3963
7 changed files with 13 additions and 11 deletions

View File

@ -16,4 +16,4 @@ if __name__ == '__main__':
p = cam_parser.CAMParser('B368/S23', c)
c.randomize()
c.start_plot(50, p.ruleset)
c.start(cam.CAM.Show.WINDOW, clock=50, rules=p.ruleset)

View File

@ -33,4 +33,4 @@ if __name__ == '__main__':
for i in range(9):
c.master.grid[35+i][12:48] = bitarray(bin(row[i])[2:].zfill(36))
c.start_console(50, p.ruleset)
c.start(cam.CAM.Show.CONSOLE, clock=50, rules=p.ruleset)

View File

@ -16,4 +16,4 @@ if __name__ == '__main__':
p = cam_parser.CAMParser('B3/S012345678', c)
c.randomize()
c.start_plot(50, p.ruleset)
c.start(cam.CAM.Show.WINDOW, clock=50, rules=p.ruleset)

View File

@ -16,4 +16,4 @@ if __name__ == '__main__':
p = cam_parser.CAMParser('B368/S245', c)
c.randomize()
c.start_plot(50, p.ruleset)
c.start(cam.CAM.Show.WINDOW, clock=50, rules=p.ruleset)

View File

@ -18,4 +18,4 @@ if __name__ == '__main__':
for i in range(49, 52):
c.master.grid[i][49:51] = 1
c.start_console(50, p.ruleset)
c.start(cam.CAM.Show.WINDOW, clock=50, rules=p.ruleset)

View File

@ -16,4 +16,4 @@ if __name__ == '__main__':
p = cam_parser.CAMParser('B2/S', c)
c.randomize()
c.start_plot(50, p.ruleset)
c.start(cam.CAM.Show.WINDOW, clock=50, rules=p.ruleset)

View File

@ -87,9 +87,11 @@ class ConsoleDisplay(_Display):
# Construct the necessary planes
self.overlays = []
for pl in self.cam.planes:
for i, pl in enumerate(self.cam.planes):
pad = curses.newpad(self.width+1, self.height+1)
self.overlays.append(pad)
if i > 0:
self.overlays[i-1].overlay(pad)
def _valid(self):
"""
@ -201,7 +203,7 @@ class WindowDisplay(_Display):
# for proper superimposition
self.matrices = []
for plane in self.cam.planes:
mshown = plt.matshow(plane.bits(), fig.number, cmap='Greys')
mshown = plt.matshow(plane.bits(), self.fig.number, cmap='Greys')
self.matrices.append(mshown)
def _valid(self):
@ -221,8 +223,8 @@ class WindowDisplay(_Display):
"""
self.cam.tick(self.rules, *self.tick_args)
if len(self.cam.master.shape) == 2:
self.mshown.set_array(self.cam.master.bits())
return [self.mshown]
self.matrices[0].set_array(self.cam.master.bits())
return [self.matrices[0]]
else:
pass
@ -241,7 +243,7 @@ class WindowDisplay(_Display):
else:
pass
ani.FuncAnimation(self.fig, self.animate, interval=self.clock)
ani.FuncAnimation(self.fig, self._animate, interval=self.clock)
plt.axis('off')
plt.show()