Skip to content

Conway's Game of Life written in Python, using Taichi framework.

License

Notifications You must be signed in to change notification settings

wivest/Game-of-Life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game of Life

Conway's Game of Life written in Python, using Taichi lang.

Conway's Game of Life

Features

Capabilities

Settings

  • Field size
  • Cell pixel size
  • Cells color
  • Start condition
  • Backend computing
  • Profiling
  • Field generation

Installation

Prerequisites

As the project is written in Python, you must have Python interpreter installed on machine to run code.

Important

Not all Python versions work with Taichi. Which specific do are listed on official website. To avoid further conflicts release 3.10.11 is recommended.

Repository

To get a local copy of repository open terminal and execute git clone command:

git clone https://github.com/wivest/Game-of-Life.git

Packages

Some external Python packages are required, including Taichi. To install them open cloned directory in terminal:

cd Game-of-Life

Tip

Optional step. Recommended to avoid package versions conflicts.
To manage Python packages virtual environment can be created. More information can be found here.

To collect missing packages execute pip install command:

pip install -r requirements.txt

Run the project

Open project folder in terminal and launch main.py file by executing python command:

python main.py

Actions in-game

  • Randomize by pressing R key.
  • Clear by pressing C key.
  • Pause by pressing Spacebar key.
  • Draw by pressing and dragging left mouse button.
  • Erase by pressing and dragging right mouse button.
  • Change brush size by pressing UP and DOWN keys.

Configuration

By editing parameters in parameters.json you can customize behaviour of application. Here available ones for user are listed:

Name Type Description
columns int Number of field columns.
Default: 1024
rows int Number of field rows.
Default: 512
size int Size of a cell in pixels.
Default: 1
arch string Backend architecture used by Taichi.
Suggested: "gpu" and "cpu".
Default: "cpu"
profiling bool Enable profiling of Taichi kernel in form of terminal output.
Default: false
alive Array Alive cell color in RGB format.
Default: [255, 255, 255]
dead Array Dead cell color in RGB format.
Default: [0, 0, 0]
highlight Array Highlighted cell color in RGB format.
Default: [50, 50, 50]
percentage float Percentage of alive cells when randomizing field.
Default: 0.1

Known issues

When using gpu backend architecture, there might be some cells with corrupted data. To prevent this, avoid fast drawing and large-sized brush. Corrupted cells are highlighted with red color. Reset field to fix data.

About

Conway's Game of Life written in Python, using Taichi framework.

Topics

Resources

License

Stars

Watchers

Forks

Languages