From 50c09332e146424d0eff4560a32b042f534e9596 Mon Sep 17 00:00:00 2001 From: Tom Weber Date: Wed, 4 Jan 2023 10:57:45 +0100 Subject: [PATCH] starting func --- src/conway/gameoflife.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/conway/gameoflife.py b/src/conway/gameoflife.py index 430355b..c07af59 100644 --- a/src/conway/gameoflife.py +++ b/src/conway/gameoflife.py @@ -96,6 +96,16 @@ def get_anime(size=100, steps=100, start="random"): anime = PlotlyAnimation(state, steps) return anime.animation +def get_starting_board(size, start=random): + # TODO: implement other starting options like e.g. glider + if start == "random": + return State(size, size, "random") + else: + return State(size, size, None) + +def start(size = 100, start="random"): + board = get_starting_board(size, start) + return PlotlyAnimation(board, size) def main(): # state = State(20, 20, [(0, 1), (1, 2), (2, 0), (2, 1), (2, 2)])