diff --git a/src/conway/anime.py b/src/conway/anime.py index 7bd9a8a..28b195c 100644 --- a/src/conway/anime.py +++ b/src/conway/anime.py @@ -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() diff --git a/src/conway/gameoflife.py b/src/conway/gameoflife.py index 1f1989d..3b2cf16 100644 --- a/src/conway/gameoflife.py +++ b/src/conway/gameoflife.py @@ -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__":