/gameoflife-python

Conway's Game of Life in an infinite space implemented in Python

Primary LanguagePythonMIT LicenseMIT

Conway's Game of Life in Python Tests

Implementation of Conway's Game of Life in an infinite space in Python. Alive cells are stored in a set. To calculate the next iteration, we compute the number of neighbors for each cell that has neighbors.

Peter Norvig has a fantastic explanation in a Jupyter Notebook.

My goal was to write a pythonic program that is easy to understand (limit the use of comprehensions).

I am implementing the Game of Life in different programming languages to learn about them. You can find all of my implementations on GitHub.

What I liked/disliked about python

  • Python syntax is easy to read and write.
  • Named tuples, iterators, defaultdict, and list comprehensions are awesome.
  • Writing tests is really easy.

Run an example

python game_of_life.py

Running the tests

Run python test.py.

More

Check out this sonification of the output of this program: https://github.com/Mystified131/GameOfMusic.