Skip to content
← Back to Community
Conway's Game of Life
Profile icon

Screenshot 2021-09-08 19.13.16
Conway's Game of Life in python!

If you don't know already, the Game of Life was made by a mathematician called John Conway. It is a cellular automaton laid out on a grid of cells. The cells are either live or dead. The rules which define this are:

  • a live cell will stay alive so long as it has at least 2 and no more than 3 other live cells around it
  • a dead cell will remain dead unless it has exactly 3 other cells around it

Over generations, some cells might die and some become live, creating unique looking patterns.

It is a 0-player game, but you can define the first generation's layout!

  • Navigate the grid using your 'w', 'a', 's' and 'd' keys
  • Alter a cell by pressing your spacebar
  • Enter a preset by pressing 'p' if you don't know what to try (you can still edit the grid after entering the preset)
  • Continue by pressing 'c' to watch the generations unfold!

I made this over the course of a couple weeks, and while there isn't actually much code, and it isn't horribly complicated, it took me quite some time to figure things out and get it working, It isn't perfect though; there are a couple bugs and the grid was limited to the size of my laptop screen, so sorry if it looks small, (or if your screen is even smaller than my laptop's), sorry if it doesn't display right (don't use the preview screen, press 'open' at the top right hand corner and use the 'fork' button in order to view in workspace).
Also, it does 34,924 checks (if my calculations are correct) every generation in order to decide the next one, so when it prints, sometimes it is jittery and doesn't look terribly nice, but hopefully it isn't too bad. I hope it works alright with you and that you like it! If you do, please upvote!

I made this alongside @SamJ13 so check his version out here:
His has a couple presets he made which are pretty cool

If you want to check out some of my previous projects, here are some links:
Basic ASCII calculator

Knots & Crosses

Profile icon
Profile icon
Profile icon