Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/insolor/game-of-life
Conway's Game of Life implementation in Python with an infinite field (online demo available thanks to pyxel)
https://github.com/insolor/game-of-life
game-of-life game-of-life-python pyxel
Last synced: about 1 month ago
JSON representation
Conway's Game of Life implementation in Python with an infinite field (online demo available thanks to pyxel)
- Host: GitHub
- URL: https://github.com/insolor/game-of-life
- Owner: insolor
- License: mit
- Created: 2024-04-25T17:44:52.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-11-27T20:19:17.000Z (about 1 month ago)
- Last Synced: 2024-11-27T21:24:25.810Z (about 1 month ago)
- Topics: game-of-life, game-of-life-python, pyxel
- Language: Python
- Homepage: https://insolor.github.io/game-of-life/
- Size: 137 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Game of Life
[![Tests](https://github.com/insolor/game-of-life/actions/workflows/test.yml/badge.svg)](https://github.com/insolor/game-of-life/actions/workflows/test.yml)
[![Deploy](https://github.com/insolor/game-of-life/actions/workflows/deploy.yml/badge.svg)](https://github.com/insolor/game-of-life/actions/workflows/deploy.yml)
[![Run in browser](https://img.shields.io/badge/Demo-run-blue)](https://insolor.github.io/game-of-life/)Classic [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)
Plans
- [x] infinite field:
- field is split into 32x32 (or 64x64) blocks, where each line in a block is an integer number, where each bit is a cell
- the whole field is a dict where keys are block coordinates and values are blocks
See [models.py](game_of_life/models.py) for inner implementation of the game field.
- [x] game loop
- [ ] implement gui using [pyxel](https://github.com/kitao/pyxel)
- [x] display field on the screen
- [x] draw visible part of the field
- [x] change scale with the mouse wheel
- [x] pan field view with the middle mouse button
- [x] controls (start/stop, step buttons)
- [x] edit with the mouse, clear the field
- [ ] add a help screen
- [ ] optimizations:
- [ ] use parallelization (blocks can be processed independently, so it's possible to process subsets of blocks in different threads/processes)
- [ ] rewrite parts in cython?## Online demo
## Running locally
Install dependencies
```shell
poetry install
```Then run
```shell
poetry run app
```Or using [poethepoet](https://github.com/nat-n/poethepoet):
```shell
poe run
```Or
```shell
poetry shell # activate the virtual environment
python -m game_of_life
```Or
```shell
poetry shell
pyxel run main.py
```Or
```shell
make run
```## Building to html
```shell
make all
```