Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexstratou/game-of-life
Conway's Game of Life
https://github.com/alexstratou/game-of-life
automata conway conway-game conway-life conways-game-of-life game-of-life game-of-life-python life life-automata object-oriented-programming python zero-player-game
Last synced: about 2 months ago
JSON representation
Conway's Game of Life
- Host: GitHub
- URL: https://github.com/alexstratou/game-of-life
- Owner: AlexStratou
- License: mit
- Created: 2024-08-11T20:13:29.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-12T17:17:37.000Z (5 months ago)
- Last Synced: 2024-08-12T21:56:36.894Z (5 months ago)
- Topics: automata, conway, conway-game, conway-life, conways-game-of-life, game-of-life, game-of-life-python, life, life-automata, object-oriented-programming, python, zero-player-game
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Game-of-life
Conway's Game of Life in python.## 1. Introduction
The Game of Life, is a zero-player game first conceived by John Horton Conway in 1970. The game is played in a 2d grid. Each gridpoint represents a live or dead cell. On each generation, the following rules are applied.
1. Any live cell with fewer than two live neighbours dies.
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.
4. Any dead cell with exactly three live neighbours becomes a live cell.For more info, visit https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life#References
## 2. Code
The game is implemented using an object oriented approach and the Python programming language. The code consists of 3 files.- life_source.py : The bulk of the code, contains the Life class which implements the game.
- utils.py : Utilities like initial seed reshape function, periodic BC index managment, some initial seeds , etc.
- run.py : The runfile of the program. The parameters are self explainatory.Note that, as of now, the simulation grid is using periodic boundary conditions.
All classes, methods and functions have been thouroughly documented in the form of docstrings.
## 3. Examples
Below are some examplary animations created by the code for various initial seeds.https://github.com/user-attachments/assets/a215c736-6dd7-4bc7-9faa-f939fc41560c
https://github.com/user-attachments/assets/455aed5c-d8d9-4c95-bf6f-f691cb57dc59
https://github.com/user-attachments/assets/9266cc5a-bbff-4e00-bff2-59b93b922528
https://github.com/user-attachments/assets/b513663a-0764-4519-b13e-b720a7f68ed8