cellular_automata.game_of_life ============================== .. py:module:: cellular_automata.game_of_life .. autoapi-nested-parse:: Conway's Game Of Life, Author Anurag Kumar(mailto:anuragkumarak95@gmail.com) Requirements: - numpy - random - time - matplotlib Python: - 3.5 Usage: - $python3 game_of_life Game-Of-Life Rules: 1. Any live cell with fewer than two live neighbours dies, as if caused by under-population. 2. Any live cell with two or three live neighbours lives on to the next generation. 3. Any live cell with more than three live neighbours dies, as if by over-population. 4. Any dead cell with exactly three live neighbours be- comes a live cell, as if by reproduction. Attributes ---------- .. autoapisummary:: cellular_automata.game_of_life.canvas_size cellular_automata.game_of_life.choice cellular_automata.game_of_life.usage_doc Functions --------- .. autoapisummary:: cellular_automata.game_of_life.__judge_point cellular_automata.game_of_life.create_canvas cellular_automata.game_of_life.run cellular_automata.game_of_life.seed Module Contents --------------- .. py:function:: __judge_point(pt: bool, neighbours: list[list[bool]]) -> bool .. py:function:: create_canvas(size: int) -> list[list[bool]] .. py:function:: run(canvas: list[list[bool]]) -> list[list[bool]] 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: -- canvas of population after one step .. py:function:: seed(canvas: list[list[bool]]) -> None .. py:data:: canvas_size .. py:data:: choice :value: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,... .. py:data:: usage_doc :value: 'Usage of script: script_name '