Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions cellular_automata/game_of_life.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ def seed(canvas):


def run(canvas):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding type hints for Game of Life?

"""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:
--
canvas : canvas of population to run the rules on.

@returns:
--
None
List
"""
canvas = np.array(canvas)
next_gen_canvas = np.array(create_canvas(canvas.shape[0]))
Expand All @@ -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):
Expand Down