Conway’s Game of Life

2016-02-13, post № 104

games, mathematics, programming, Pygame, Python, #cells, #cell, #cell simulation, #cellular, #cellular automation, #cellular game, #cellular simulation, #John Conway, #simulation

This program is a simulation of the famous cellular automaton created by John Conway. The so-called ‘game’ is rather a simulated evolution of cells in a two-dimensional world. Each cell can either be dead (black) or alive (white) and always has eight neighbours surrounding them. In each cycle of the simulation their state will be changed based on two simple rules, which are listed below.
Despite the rule’s simplicity, the outcomes are often very interesting and complex.
For more details on the game of life, check this Wikipedia entry.

The Rules

  • A live cell can only survive with exactly 𝟤 or 𝟥 neighbours, or else it dies.
  • A dead cell with exactly 𝟥 neighbours comes to life.


  • Left click turns cell at current mouse position alive,
  • Right click turns cell at current mouse position dead,
  • ‘r’ turns every cell dead,
  • ‘q’ cycles once,
  • ‘w’ cycles continuously.
Source code: conways-game-of-life.py

J-Filters V

2016-02-06, post № 103

programming, Pygame, Python, #contrast, #detection.sobel, #digital image filter, #edge, #edge detection, #filter, #image, #image filter, #img, #img filter, #J-Filter

This filter runs an edge detection algorithm on a given image.
For demonstration I used — as in my previous filter posts — an image from my post Stacking Stones.


The image with applied edge detection filter:

Source code: j-filters-v_edge-detection.py

Colored Rectangles

2016-01-30, post № 102

programming, Pygame, Python, #color, #mouse, #mouse controlled, #polygons, #rect, #rectangle, #rects

This program lets you spawn in a rectangle with a randomly assigned color. This rectangle will then slowly move towards the screen’s edge, eventually fading away.


  • Left click spawns in a new rectangle at current mouse position,
  • ‘Space’ takes a screenshot.
Source code: colored-rectangles.py
Jonathan Frech's blog; built 2021/04/16 20:21:20 CEST