glider and acorn start
ci/woodpecker/push/woodpecker Pipeline was successful Details

master
Tom Weber 2 years ago
parent 7c56c9fa6f
commit 62cfa5de1f

@ -6,6 +6,7 @@ class PlotlyAnimation(object):
self.state = state
self.steps = steps
self.frames = np.expand_dims(self.state.board, axis=0)
print(self.frames[:10, :10])
self.frame_gen()
self.animation = self.animation_gen()

@ -95,16 +95,20 @@ def get_starting_board(size, start="random"):
# TODO: implement other starting options like e.g. glider
if start == "random":
return State(size, size, "random")
if start == "glider":
return State(size, size, [(0, 1), (1, 2), (2, 0), (2, 1), (2, 2)])
if start == "acorn":
return State(size, size, coords=[(20+5, 20+3), (20+5, 20+4), (20+3, 20+4), (20+4, 20+6), (20+5, 20+7), (20+5, 20+8), (20+5, 20+9)])
else:
return State(size, size, None)
def get(size = 507, steps = 200, start="random"):
def get(size = 50, steps = 200, start="random"):
board = get_starting_board(size, start)
return PlotlyAnimation(board, steps).animation
def main():
animation = get(50)
animation.show()
anime = get(50, 200, "acorn")
anime.show()
if __name__ == "__main__":

Loading…
Cancel
Save