Sadly, John Horton Conway has passed away. While Conway's contributions to computational mathematics over the years are numerous and eclectic, many aspiring coders are introduced to his work via Conway's Game of Life, a cellular automaton that's relatively simple to implement.
In the Game of Life, you provide an initial state, or seed, to a square grid of cells. Each cell is either "on" or "off", and the next state of the grid is calculated via these rules, as stated on Wikipedia:
- Any live cell with two or three live neighbors survives.
- Any dead cell with three live neighbors becomes a live cell.
- All other live cells die in the next generation. Similarly, all other dead cells stay dead.
As this is relatively simple to write logic for, many programmers take a stab at implementing such a program early in their careers. Here's mine on GitHub, from July 2017, as one of my first Rust programs - but not terribly interesting to look it as it just renders world states in text to the terminal. However, it does demonstrate how trivial the core logic is to write:
//tick_cell takes a Coord and a World and returns the next state of the cell
fn tick_cell(c: &Coord, w: &World) -> bool {
let s = moore_sum(c, w);
if get_cell(c, w) {
match s {
2 | 3 => true, //ALIVE
_ => false, //overcrowded or starved
}
} else {
match s {
3 => true, //3 gives birth
_ => false, //barren
}
}
}
Do you have a Game of Life to show us? Bonus points for an implementation we can play with - my entry must be downloaded and compiled, but I'm sure some of you web-dev-y types have something more interactive!
What are some of your favorite seeds? Are there other cellular automata that interest you?
Alternatively, what other John Conway work has inspired you? According to this redditor, Conway was frustrated that the Game of Life was his most well-known contribution. What else do you remember him for?
Image: wikimedia commons