Skip to main content

Transform your GitHub contribution graph into Conway's Game of Life.

Project description

gh-game-of-life

Transform your GitHub contribution graph into Conway's Game of Life.

Example

Usage

One time generation

Check out the web demo and generate a GIF in seconds without installing anything locally.

GitHub Action

Automatically update your game GIF daily using GitHub Actions! Add this workflow to your repository at .github/workflows/update-game.yml:

name: Update Game of Life Game

on:
  schedule:
    - cron: '0 0 * * *'  # Daily at midnight UTC
  workflow_dispatch:  # Allow manual trigger

permissions:
  contents: write

jobs:
  update-game:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: apoupon/gh-game-of-life
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          output-path: 'game.gif'
          strategy: 'random'

Then display it in your README:

![My GitHub Game](game.gif)

From PyPI

pip install gh-game-of-life

From source

# Clone the repository
git clone https://github.com/apoupon/gh-game-of-life.git
cd gh-game-of-life

# Install with uv
uv sync

# Or with pip
pip install -e .

Setup

  1. Create a GitHub Personal Access Token:

  2. Set up your environment:

    # Copy the example env file
    touch .env
    echo "GITHUB_TOKEN=your_token_here" >> .env
    

    Alternatively, export the token directly:

    export GITHUB_TOKEN=your_token_here
    

Usage

Generate Your Game GIF

# Basic usage - generates username-gh-life.gif
gh-game-of-life <username>

# Specify output filename
gh-game-of-life torvalds --output my-gif.gif
gh-game-of-life torvalds -o torvalds-life.gif

# Adjust the number of simulation frames
gh-game-of-life torvalds --frames 100
gh-game-of-life torvalds -f 200

# Control frame delay (milliseconds per frame)
gh-game-of-life torvalds --frame-delay 500
gh-game-of-life torvalds -d 250

# Load settings from a YAML configuration file
gh-game-of-life --config config.yaml

On Conway's Game of Life

The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is a zero-player game meaning that its evolution is determined by its initial state, requiring no further input. Despite being governed by just three simple rules, it can give rise to incredibly complex behaviors and patterns. The Game of Life is a perfect example of how simple rules can generate unexpected complexity.

A cool documentary on Conway's Game of Life can be found here: https://www.youtube.com/watch?v=Kk2MH9O4pXY

On the Quad Life variant

An interesting variation of the Life rules is to use several distinct living state, with each behaving according to Life rules, but, in addition, carrying independent color information. The color of each newly-born bit is determined by the color of its parents. Resulting patterns have exactly the same life/death behavior as in normal Life, but the colors of resulting bits provides interesting additional complexity.

This project uses the Quad-Life variant, which employs four symmetrical colors, creating vibrant, evolving patterns while maintaining the familiar Life behavior.

Coding with AI

This project also serves as an experiment in coding with AI assistants. I have been using LLMs in my development workflow for a while but had not yet explored specialized coding agents such as Claude Code, Cursor, or GitHub Copilot in Agent mode. For this project, I experimented with GitHub Copilot and Claude Sonnet 4.5, taking the project from initial idea to working implementation.

I drew inspiration from the BMAD method ("Build More, Architect Dreams") and followed a structured workflow: starting with a product brief, then moving through product requirement design, UX design, software architecture, and breaking work into epics and stories. Development and testing occurred in iterative loops, completing tests before moving on to the next story or epic.

It was smooth and fast.

Acknowledgements

I got the idea from czl9707's Github Space Shooter and discovered the Quad Life variant of the Conway's game of life through this resource.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gh_game_of_life-0.1.0.tar.gz (42.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gh_game_of_life-0.1.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file gh_game_of_life-0.1.0.tar.gz.

File metadata

  • Download URL: gh_game_of_life-0.1.0.tar.gz
  • Upload date:
  • Size: 42.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gh_game_of_life-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4422e0a39fb76a1bcba9644f3f456de246c42d5848276aa4aba6314d736bf989
MD5 6d80f58a4a29ec8f456613976353d029
BLAKE2b-256 86620c7eff0dd9733ffe9326584d776f0956dbb01140aceac44b5e2e63d263c8

See more details on using hashes here.

File details

Details for the file gh_game_of_life-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gh_game_of_life-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gh_game_of_life-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6331540621a988e0a7a67c240cf5f7caf9dda228e4515ff75093a9c74b174a05
MD5 88db59a85fd1e4ed5b9cdd0a31d8e937
BLAKE2b-256 68e0011b35e359fcc872501cfbe9111ce52fc47b1b1abac9e968959b9b7dbb80

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page