cellular_automata.game_of_life¶
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 <canvas_size:int>
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¶
Functions¶
|
|
|
|
|
This function runs the rules of game through all points, and changes their |
|
Module Contents¶
- cellular_automata.game_of_life.__judge_point(pt: bool, neighbours: list[list[bool]]) bool ¶
- cellular_automata.game_of_life.create_canvas(size: int) list[list[bool]] ¶
- cellular_automata.game_of_life.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
- cellular_automata.game_of_life.seed(canvas: list[list[bool]]) None ¶
- cellular_automata.game_of_life.canvas_size¶
- cellular_automata.game_of_life.choice = [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,...¶
- cellular_automata.game_of_life.usage_doc = 'Usage of script: script_name <size_of_canvas:int>'¶