Skip to content
A Guile implementation of Conway's Game of Life
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Conway's Game of Life in Guile

This is Conway's Game of Life, written in Guile, an implementation of the Scheme programming language. To augment the more idiomatic Scheme implementation on Rosetta Code, this version explores how one deals with the more day-to-day aspects of software development in Guile, such as:

  • Code organisation with modules
  • Encapsulation with closures and message passing
  • Unit testing
  • IO

The Game

Load it up into the interpreter with guile -l gameoflife.scm. Functions exposed are:

  • game-of-life: function that creates the game of life closure, which can receive the following messages:
    • (setgrid! grid): stores grid (a list of list of 0s and 1s) into the game
    • (getgrid): gets the current pattern from the game
    • (step!): increments the generation
  • pretty-print-grid: converts a grid to a more readable string
  • grid-from-file: loads up a grid from file
  • send: sugar function for sending a message
  • new-instance: sugar function for instantiating a new closure

See tests (below) for usage.


Uses srfi-64, an API for writing test suites. The Guile 2.0 port is by Sunjong Lee, also included in this repository for convenience. Copy it into the site packages directory, where third party Scheme files should be placed:

sudo cp ./srfi-64-guile/srfi/srfi-64.scm /usr/share/guile/site/2.0/srfi/srfi-64.scm

Run tests with

guile -l gameoflife.scm gameoflife-test.scm

and output should be written to game_logic.log and utility_functions.log


Scheme newbie here, so contributions on better ways of doing things are welcome!


You can’t perform that action at this time.