

Programatic Representation The Game Of LifeĪt its core, the Game Of Life is a two-dimensional grid, where each cell is dead or alive. More precisely, we want to represent cells that are either alive or dead. So since the Game Of Life is a cellular automation system (assumed to be a two-dimensional grid in this post), we need a way of representing cells in a grid. In this section, we will analyse the Python structures that represent the Game Of Life.Īn easy way to get into the right mindset for this task is by throwing away all the complexity of the problem - in this case, the Game Of Life - and think about the data implied by the problem’s statement. Without further ado, we will begin to talk about the implementation. For this reason, the gif above, which shows a lot of cells being born, also has cells dying due to other rules. Figure 3: A complex example of how cells can give birth in the game of life.Īdmittedly, I struggled to find a simple initial setup that would only have cell birth in its iterations. More specifically, Conway modeled this idea by having dead cells become alive when they have exactly three alive neighbours. We should all be fairly aware of what “birth” means. In the following iteration, they respawn as those cells have exactly three neighbours each. As you can see, the corner cells die out as each of them have exactly four alive neighbours. The gif above shows a fairly popular oscillator in the Game Of Life. Figure 2: The “beacon” example in Conway’s Game Of Life, where the corner cells in the blocks die out in the first iteration. Conway’s modeled this idea in the Game Of Life by having cells dying off when they have more than three live neighbours. In simple terms, overpopulation means that there are too many inhabitants using the resources of a particular area.Īs a result, issues like poverty, pollution, and poor quality of life may arise in overpopulated places. Have you heard of Hong Kong? How about Mumbai? Or perhaps even São Paulo? These places are all overpopulated. Interestingly, finding an analogy to this concept in the real world is quite difficult the human population has grown exponentially pretty much everywhere in the last century or so, hence most places are actually overpopulated! Overpopulation Examples The figure above shows the effect of that rule in certain scenarios in the Game Of Life. Figure 1: All the cells in the above Game Of Life disappear after the first iteration, as they have less than two neighbours. Conway modeled this concept by stating that, in the Game Of Life, cells that have less than two neighbours will die. When a region doesn’t have enough workers to exploit the resources of an area efficiently and support the wider population, the region is said to be underpopulated. In other words, the only input to the game is a list of the cells that start off alive, the future iterations of the game rely on the first input. Examples Of Cell Behaviour In The Game Of Lifeīefore this post gets way too technical, let’s look at some examples of how cells behave in the three rules mentioned above.Ĭontextually, the Game Of Life only requires a single input: the state of the initial grid. Interestingly, these three rules are the entirety of the Game Of Life! As you can probably guess, the intention of the game is to simulate evolution through simple rules that model how cells should behave. Birth: any dead cell with exactly three neighbours will become alive in the next iteration of the game.Over population: any alive cell with more than four neighbours will die in the next state of the game.

Under population: any alive cell with less than two neighbours will die in the next iteration.Under population, overcrowding, and birth are the three concepts modeled in Conway’s Game Of Life, with the following rules: The rules of the game of life model the growth of the cell population in a grid. In this post, we will outline the rules of the game, look at how the rules change the state of the cells, and how complicated (yet interesting) structures can be made with only three rules! Rules Of The Game Of Life – Simplicity Creates Complexity Moreover, this post is part of my Python implementations series, where we previously looked at topics such as implementing the trapezium rule in Python. I’ve actually been tasked to implement parts of the game in previous jobs interviews for well-known companies! It may not be the first time you come across the Game Of Life, in fact, it’s very popular among coders. His most well-known invention, perhaps not so mathsy, is the “Game Of Life” – a two-dimensional cellular environment, where each cell obeys a short list of rules. John Conway was a very active British mathematician and authored several research papers on topics like numbers and group theory.
