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) p = cam_parser.CAMParser('B368/S23', c)
c.randomize() 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): for i in range(9):
c.master.grid[35+i][12:48] = bitarray(bin(row[i])[2:].zfill(36)) 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) p = cam_parser.CAMParser('B3/S012345678', c)
c.randomize() 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) p = cam_parser.CAMParser('B368/S245', c)
c.randomize() 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): for i in range(49, 52):
c.master.grid[i][49:51] = 1 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) p = cam_parser.CAMParser('B2/S', c)
c.randomize() 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 # Construct the necessary planes
self.overlays = [] 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) pad = curses.newpad(self.width+1, self.height+1)
self.overlays.append(pad) self.overlays.append(pad)
if i > 0:
self.overlays[i-1].overlay(pad)
def _valid(self): def _valid(self):
""" """
@ -201,7 +203,7 @@ class WindowDisplay(_Display):
# for proper superimposition # for proper superimposition
self.matrices = [] self.matrices = []
for plane in self.cam.planes: 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) self.matrices.append(mshown)
def _valid(self): def _valid(self):
@ -221,8 +223,8 @@ class WindowDisplay(_Display):
""" """
self.cam.tick(self.rules, *self.tick_args) self.cam.tick(self.rules, *self.tick_args)
if len(self.cam.master.shape) == 2: if len(self.cam.master.shape) == 2:
self.mshown.set_array(self.cam.master.bits()) self.matrices[0].set_array(self.cam.master.bits())
return [self.mshown] return [self.matrices[0]]
else: else:
pass pass
@ -241,7 +243,7 @@ class WindowDisplay(_Display):
else: else:
pass pass
ani.FuncAnimation(self.fig, self.animate, interval=self.clock) ani.FuncAnimation(self.fig, self._animate, interval=self.clock)
plt.axis('off') plt.axis('off')
plt.show() plt.show()