File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 10
10
- 3.5
11
11
12
12
Usage:
13
- - $python3 game_o_life <canvas_size:int>
13
+ - $python3 game_of_life <canvas_size:int>
14
14
15
15
Game-Of-Life Rules:
16
16
@@ -52,15 +52,16 @@ def seed(canvas: list[list[bool]]) -> None:
52
52
53
53
54
54
def run (canvas : list [list [bool ]]) -> list [list [bool ]]:
55
- """This function runs the rules of game through all points, and changes their
55
+ """
56
+ This function runs the rules of game through all points, and changes their
56
57
status accordingly.(in the same canvas)
57
58
@Args:
58
59
--
59
60
canvas : canvas of population to run the rules on.
60
61
61
62
@returns:
62
63
--
63
- None
64
+ canvas of population after one step
64
65
"""
65
66
current_canvas = np .array (canvas )
66
67
next_gen_canvas = np .array (create_canvas (current_canvas .shape [0 ]))
@@ -70,10 +71,7 @@ def run(canvas: list[list[bool]]) -> list[list[bool]]:
70
71
pt , current_canvas [r - 1 : r + 2 , c - 1 : c + 2 ]
71
72
)
72
73
73
- current_canvas = next_gen_canvas
74
- del next_gen_canvas # cleaning memory as we move on.
75
- return_canvas : list [list [bool ]] = current_canvas .tolist ()
76
- return return_canvas
74
+ return next_gen_canvas .tolist ()
77
75
78
76
79
77
def __judge_point (pt : bool , neighbours : list [list [bool ]]) -> bool :
You can’t perform that action at this time.
0 commit comments