The Problem
Your mission is to implement a hyped-up version of the game of Life, originally conceived by the British mathematician J.H. Conway in 1970 and popularized by Martin Gardner in his Scientific American column. The game is a simulation that models the life cycle of bacteria. Given an initial pattern the game simulates the birth and death of future generations using simple rules. Think of it as a Lava Lamp for mathematicîans.
The game is played on a two-dimensional grid Each grid location is either empty or occupied by a single cell (X). A location’s neighbors are any cells m die surrounding eight adjacent locations.
In the following example, the shaded middle location has three “live” neighbors:
? X
X
X
i I !
The Rules
The simulation starts wit h an initial pattern o f cells on the grid and computes successive generations of cells according to die following rules:
1. A location that has zero or one neighbors will be empty in the next generation. If a cell was in that location, it dies of loneliness.
Leave a Reply