PyGameofLife is a simple implementation of Conway’s Game of Life using Python. It features a command-line interface that allows users to generate and customize animations of cellular automata. The focus is on readability and simplicity rather than performance optimization.
PyGameofLife requires numpy and matplotlib. Install them using:
pip install numpy matplotlibTo get the code, run:
git clone https://github.com/robertmartin8/PyGameofLife
cd PyGameofLifeTo start the simulation with the default settings, run:
python life.pyThis will generate an animation saved as infinite.gif in the current directory.
To see all available options, run:
python life.py --help--universe-size X,Y→ Set the grid size.-seed SEED_NAME→ Choose a predefined seed pattern.-n N→ Define the number of iterations.-interval TIME→ Set the time interval (in ms) between updates.-quality DPI→ Adjust the image quality.-cmap COLOR_MAP→ Change the color scheme.--seed-position X,Y→ Set the initial position of the seed.
Run the simulation with a predefined seed:
python life.py -seed diehardRun with a smaller grid and custom colors:
python life.py -seed beacon --universe-size 6,6 --seed-position 1,1 -cmap plasma_rSeeds are predefined patterns. The available options include diehard, boat, r_pentomino, beacon, and more. To add a new seed, modify the seeds dictionary in life.py.
This project is designed as an educational tool to demonstrate cellular automata using Python. The code prioritizes readability and intuitive design over efficiency.
