From a8ff2cbb6ef52ebc01fb4a5fe7acc282de6da0f0 Mon Sep 17 00:00:00 2001 From: "Minha, Jeong" <60059706+PzaThief@users.noreply.github.com> Date: Sun, 3 Oct 2021 00:44:30 +0900 Subject: [PATCH 1/3] Update game_of_life.py docstring error fix delete no reason delete next_gen_canvas code(local variable) --- cellular_automata/game_of_life.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cellular_automata/game_of_life.py b/cellular_automata/game_of_life.py index 09863993dc3a..f2ce09440882 100644 --- a/cellular_automata/game_of_life.py +++ b/cellular_automata/game_of_life.py @@ -52,7 +52,7 @@ def seed(canvas): def run(canvas): - """This function runs the rules of game through all points, and changes their + """This function runs the rules of game through all points, and changes their status accordingly.(in the same canvas) @Args: -- @@ -60,7 +60,7 @@ def run(canvas): @returns: -- - None + List """ canvas = np.array(canvas) next_gen_canvas = np.array(create_canvas(canvas.shape[0])) @@ -71,9 +71,7 @@ def run(canvas): pt, canvas[r - 1 : r + 2, c - 1 : c + 2] ) - canvas = next_gen_canvas - del next_gen_canvas # cleaning memory as we move on. - return canvas.tolist() + return next_gen_canvas.tolist() def __judge_point(pt, neighbours): From afe53a956488c108baa3c2044d211117ec8ddf35 Mon Sep 17 00:00:00 2001 From: Tianyi Zheng Date: Mon, 31 Jul 2023 14:13:40 -0700 Subject: [PATCH 2/3] Update cellular_automata/game_of_life.py --- cellular_automata/game_of_life.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cellular_automata/game_of_life.py b/cellular_automata/game_of_life.py index f2ce09440882..8127c2bd20b5 100644 --- a/cellular_automata/game_of_life.py +++ b/cellular_automata/game_of_life.py @@ -60,7 +60,7 @@ def run(canvas): @returns: -- - List + canvas of population after one step """ canvas = np.array(canvas) next_gen_canvas = np.array(create_canvas(canvas.shape[0])) From b310c14266994bb6c68324952d5004b5f253d31e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 21:19:19 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- cellular_automata/game_of_life.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cellular_automata/game_of_life.py b/cellular_automata/game_of_life.py index 56e85b8c3c6e..d691a2b73af0 100644 --- a/cellular_automata/game_of_life.py +++ b/cellular_automata/game_of_life.py @@ -51,7 +51,6 @@ def seed(canvas: list[list[bool]]) -> None: canvas[i][j] = bool(random.getrandbits(1)) - def run(canvas: list[list[bool]]) -> list[list[bool]]: """ This function runs the rules of game through all points, and changes their