Game of Life in Every Language
Published on 01 November 2018 (Updated: 02 November 2018)
For those of you that don’t know, the Game of Life is basically a cell simulation where cells are arranged in an infinite grid. Each cell has one of two states: alive or dead.
At each turn, all cells are evaluated using the following rules:
- Any live cell with fewer than two live neighbors dies, as if caused by underpopulation.
- Any live cell with two or three live neighbors lives on to the next generation.
- Any live cell with more than three live neighbors dies, as if by overpopulation.
- Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
For more information, check out the Wikipedia page for Conway’s Game of Life.
Requirements
Of course, for the purposes of the repo, here are the requirements for a contribution:
- Source code must fit in a single file
- Grid must wrap-around on the edges (think asteroids)
- The program must support the following command line arguments
- Grid width (assume square grid)
- Frame rate (frames/second)
- Total number of frames
- Spawn rate (% of living vs. dead as decimal between 0 and 1)
- Simulation must be a GUI
- An exception to this rule can be made for languages where it’s impossible or impractical to have an actual GUI. In that case, a terminal application is sufficient.
Beyond that, there’s really no hard-and-fast requirements. All I ask is that solutions are minimal. In other words, don’t worry about command line options or GUI elements. Keep it simple. Remember, the goal is to show off language features.
Also, I ask that you don’t use external libraries. I like for these files to be as easy as possible to test, so limiting dependencies is helpful.
Testing
Verify that the actual output matches the expected output. See the requirements section for an example of the expected output.
Articles
Currently, there are no articles. If you’d like to begin contributing, head over to the repo to get started.