pilosus / gol

Conway's Game of Life

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conway's Game of Life

Game of Life implementation inspired by Łukasz Langa's talk on EuroPython 2023.

Current implementation differs in that:

  • it's simple, ASCII-art & terminal-based
  • each evolutionary step of the game is visible in the terminal history
  • a seed (initial board) can be passed in as a user input

That makes the game fun and easy to experiment with.

screencast

Usage

  1. Clone the repo

  2. Install the package locally in editable mode

$ make install-package
  1. Run the Game of Life with the sensible defaults
$ gol
  1. Use command line options to adjust the gameplay as needed
$ gol --seed docs/seeds/basic.txt \
    --speed=10 \
    --color-live=green \
    --color-dead=white
  1. Get help
$ gol --help

Seed from a file

A board seed can be provided as a file using --seed path/to/a/file CLI option. The seed file must be a text file representing 2D array. Dead cells represented by value 0, live cells by the value 1. Elements in a row separated by a single space character.

When the seed file is passed in, --size option is ignored and adjusted to the share of the seed array automatically.

See an example seed file in the repo.

About

Conway's Game of Life

License:Apache License 2.0


Languages

Language:Python 82.0%Language:Makefile 18.0%