Variations on Conway’s Game of Life and Other Cellular Automata
David Hua and Martin Pelikan
Research Paper Presented to the
Students and Teachers as Research Scientists Program
at the University of Missouri-St. Louis
Sponsored by
LMI Aerospace, Inc./D3 Technologies
and The Solae Company
July 2012
Abstract
Cellular automata, like Conway's game of life, are computational
models that use a set of simple rules and initializations to create a changing
environment of cells over time, and can result in complex behaviors that make
them suitable for simulating systems in a range of scientific and mathematical
fields. A C++ program was used to test for the effects of initializations on the
population dynamics of the game of life and several variants. Statistical results
suggest the existence of a range of population patterns spanning very different
automata, some of which are similar to ecological patterns, and additional
lifelike phenomena when more cell types are involved.
Variations on Conway’s Game of Life and Other Cellular Automata
Abstract
Cellular automata, like Conway's game of life, are computational models that use a set of simple
rules and initializations to create a changing environment of cells over time, and can result in complex
behaviors that make them suitable for simulating systems in a range of scientific and mathematical
fields. A C++ program was used to test for the effects of initializations on the population dynamics of
the game of life and several variants. Statistical results suggest the existence of a range of population
patterns spanning very different automata, some of which are similar to ecological patterns, and
additional lifelike phenomena when more cell types are involved.
1
Introduction
Cellular automata (Codd, 1968; von Neumann, 1966; Weisstein, n.d.) are simulations in which a set of
parameters and starting conditions produce an evolving environment. These simulations have several
similarities: they involve a grid of cells, each with a state; they change over a series of discrete time
steps; and they evolve based on rules describing how each cell interacts with its neighbors. The type of
grid, the rules, and the number of possible states vary among cellular automata. The complex behaviors
cellular automata exhibit allow them to simulate a wide variety of systems and computations, including
computer programs and systems in theoretical biology, physics and mathematics. Cellular automata can
also be used to demonstrate and simulate emergence, self-organization and self-replication. A wellknown cellular automation is Conway's game of life (Gardner, 1970), which is capable of producing
complex results such as various cell structures that can move across the grid or oscillate between states.
Some of the more recent studies involving cellular automata include Wolfram (2002) and Zenil (2010).
The objectives of the project are twofold: (1) gain basic programming skills to enable
implementation of simple cellular automata, and (2) use these skills to implement and study a
simulation of Conway's game of life and its variants. To gain programming skills, the programming
language C++ was used to study programming concepts through a series of increasingly complex
problems from mathematics and number theory. In the simulations of cellular automata, the effects of
different initial parameters and rules on the behavior of the simulation were analyzed.
The remainder of the paper is organized as follows. Section 2 will describe Conway's Game of
Life and its variations. Section 3 will present the various parameters and variants that were tested.
Section 4 will include a summary and conclusions. Appendix A will outline the programming concepts
studied during this project and present some of the programming problems considered.
2
Conway's Game of Life
The purpose of this section is to provide an overview of the game of life and introduce the relevant
variables and variations to be tested. Section 2.1 will explain the rules of the game of life and discuss
its general behavior. Section 2.2 will present some variations on the original rules of this automaton.
Section 2.3 will introduce the scenarios and variables that will be examined in this study.
2.1
Life
John Conway’s game of life (Gardner, 1970) is a cellular automaton with rules resembling the
multiplication of real organisms and their intolerance for underpopulation and overpopulation. As with
other cellular automata, the game of life takes place on a finite dimensional lattice (in this case, a twodimensional grid). Cells are considered to be neighbors if they are diagonally adjacent, so each cell has
a total of eight neighbors. Each cell is in one of two states: live or dead. The rules for the simulation are
as follows:
1. A dead cell becomes alive if it has exactly 3 alive neighbors (reproduction).
2. A living cell with more than 3 alive neighbors or fewer than 2 alive neighbors becomes a dead
cell (overpopulation or underpopulation).
3. Otherwise, the cell remains in the original state. Therefore, a dead cell with fewer than 3 alive
neighbors or more than 3 alive neighbors remains dead; a living cell with 2 or 3 alive neighbors
remains alive.
These changes occur simultaneously without affecting each other. Among the main motivations for
these rules was the desire to create a system that share similarities with biological systems and provides
a range of interesting behaviors that are not easy to predict despite the simplicity of the basic rules.
The structures such a simulation can produce include static, stable structures of living cells that
do not change over time, oscillating structures that change between two or more forms with a fixed
period, and structures that appear to move in a certain direction while maintaining the basic shape. In
our simulations, we assume that the neighborhoods wrap around (the cells in the top row are neighbors
of the corresponding cells in the bottom row and analogically for the left-most and right-most
columns); therefore, the world is assumed to be a torus, not a conventional two-dimensional grid.
Figure 1. An example 5-by-5 world in two consequent time steps.
In the example world shown in Figure 1, Conway’s rules are applied to a five-by-five world in
which each asterisk (symbol “*”) represents a living cell. The cells on the upper left and lower right are
neighbors, but do not have the required two or three total to survive. Meanwhile, the cells marked in
red each have a total of three neighbors, allowing them to become living cells in the next time interval.
2.2
Variants
While the standard set of rules for the game of life is popular and results in a range of interesting
behaviors, one may modify the rules to produce radically different behaviors (Wójtowicz, 2001). All of
these variations specify two main parameters: (1) the condition for a dead cell to become alive, and (2)
the condition for a living cell to survive; at least one of these conditions is expected to be different from
the original rule set. The variations can be categorized into several categories. Conway’s game of life
and similar variations are known as chaotic cellular automata for their unpredictability and dynamics.
These rule sets are able to create the moving structures that are so prominent in Conway’s rules.
Meanwhile, other rule sets create worlds that grow into stable, predictable patterns that change very
little and often become completely static.
A wide range of possibilities is available when additional living states are available.
The original game of life rules can apply similarly as before, but the rules can define the color of
newborn cells and can be modified even further to account not only for the number of living neighbors
but also for their color (state). One possibility is to create a new cell based on the cell type that is more
common among neighbors when the cell is born (becomes alive). Alternatively, the two cell types may
have different behaviors altogether.
2.3
Scenarios
Testable parameters for cellular automata involve the initialization variables and the rule set. In the
simulation program created for the project, the starting independent variables include the world size,
the initial concentration of living cells, and the number of states. The initial concentration determines
the expected percentage of living cells in the first time step. These cells are distributed throughout the
world using a pseudo-random number generator that makes each cell alive with a specified probability
(concentration). Since the initialization is stochastic, multiple runs of the simulation are performed,
each with a different initial distribution of the living cells. As described above, rules with more than
one living state can feature interactions between species or groups. Scenarios include symmetrical rules
where each living state operates the same way or rules in which cell types propagate differently.
3
Simulations
The objective of the simulations was to study the range of behaviors that the game of life and its
variations can exhibit. To accomplish this, a C++ program was implemented that simulates the game of
life and provides both the world states as well as the statistics of the simulations. The statistics describe
the effects of the initial concentration of living cells on the percentage of the world that contains living
cells at each time step and the percentage of cells that have changed states since the last time step. The
resulting averages are based upon the results of a simulation running on a 20 by 20 world arranged on a
torus, with 50 independent runs for each setting. The program is initialized with a living cell
concentration of every multiple of 10% from 10% to 90%, and for each initialization setting, the
simulation is run for 100 time steps.
As mentioned above, the rules for game of life and similar cellular automata can be divided into
several categories. First, there are rules with varying numbers of possible states, allowing for differing
degrees of complexity. Among the two-state rules, there are rules with high levels of continuous
activity (chaotic automata) and rules that tend to be more static or stable.
3.1
Single-State Rules
3.1.1 “Life” and Other Chaotic Rule Sets
Conway’s “Game of Life”
One of the interesting questions when studying the game of life and its variations is concerned with the
effects of the initialization parameters on the dynamics of the world. One of Conway’s original goals in
designing the original set of rules was to prevent the cells from dying out too rapidly and to prevent
populations from growing uncontrollably. Of course, extremely underpopulated and overpopulated
worlds would still be often expected to die out quickly, due to the underpopulation and overpopulation,
respectively. A series of experiments were performed to verify whether the original rule set ensures this
design principle in practice.
As shown in Figure 2, each initialization between 20% and 60% causes the living cell
percentage to drop before gradually becoming less steep and appearing to approach a horizontal
asymptote, indicating a stable state. However, despite the wide range of values in the first time step, the
graphs for each initial concentration approach similar asymptotes, reaching approximately a 10%
concentration of living cells by time 100.
Population Level Over Time
Initial: 20% - 60%
70
60
% Living Cells
50
20.00%
30.00%
40.00%
50.00%
60.00%
40
30
20
10
0
Time Step
Figure 2. The initial concentrations between 20% and 60% for the original rule set of the game of life appear to
converge to approximately the same concentration of the living cells regardless of the initial proportion.
However, the same cannot be said about other initializations. The concentrations of 10% and
70% (shown in Figure 3) lead to stable states with different final concentrations, while the initial
concentrations of 80% and 90% predictably result in the world consisting of nearly no living cells due
to overpopulation.
Population Level Over Time
Initial: 10%, 70% - 90%
100
90
80
% Living Cells
70
10.00%
70.00%
80.00%
90.00%
60
50
40
30
20
10
0
Time Step
Figure 3. The initial concentrations of 10%, 70%, 80%, and 90% for the original rule set of the game of life
result in different states than concentrations between 20% and 60%.
The rates of change follow a similar pattern for a broad range of initial concentrations. As
shown in Figure 4, all initializations between 20% and 60% initially have high rates of change but
eventually approach the same rate of change of approximately 8%. Meanwhile, the remaining
initializations (shown in Figure 5) similarly have a high initial rate of change but dropped to zero
(when the population died out) or continued at a very low level.
Rate of Change Over Time
Initial: 20% - 60%
% Change From Previous Time Step
60
50
20.00%
30.00%
40.00%
50.00%
60.00%
40
30
20
10
0
Time Step
Figure 4. The rate of change for the original rule set of the game of life approaches approximately the same
value for a broad range of initial concentrations.
Rate of Change Over Time
Initial: 10%, 70%-90%
100
% Change From Previous Time Step
90
80
70
10.00%
70.00%
80.00%
90.00%
60
50
40
30
20
10
0
Time Step
Figure 5. The rate of change for very high or low initial concentrations quickly reaches zero or a very low value.
The actual behavior of the game of life is interesting also because a wide range of structures
form regularly. Overall, areas of cells tend to coalesce into mobile masses of cells, like the one pointed
out in Figure 5. These masses are constantly changing, occasionally forming symmetrical, exploding
patterns. As the masses of cells move, they leave in their wake a variety of other structures. The two or
three neighbor survival rule of the game of life allows certain structures of living cells to remain static,
with each cell positioned to have 2 or 3 living neighbors. A common example is the block of 4 cells
seen in Figure 6. Also common are the oscillator structures, such as a line of 3 cells (horizontal or
vertical), with dead cells around it. These structures do change over time in a series of repeating
changes.
Figure 6. Interesting structures created in simulations of the 20x20 game of life with the original rule set.
The results for a range of initializations suggests that a broad range of initial configurations lead
to a similar behavior with a variety of interesting static and dynamic structures, but that extreme
concentrations yield a much less interesting scenario where the world becomes overly simple
(consisting of mostly dead cells). There appears to be no single concentration that would lead to the
highest stable concentration of cells. The initializations that did not behave in this manner likely lacked
a necessary starting population to reproduce enough or were so overpopulated that the worlds could not
recover from the initial population drop. The similar asymptotes that the population graphs approach
are reminiscent of the way populations of organisms reach equilibrium, where the population remains
constant at a level that consumes just the right amount of resources to sustain itself. The rules of the
game of life, which punish overpopulation and underpopulation, are the main cause for the simulation
to stabilize at similar optimum levels.
Day and Night Rule Set
The day and night rule set, proposed by Nathan Thompson in 1997 (Bell, 1997), is a game of life
variant in which groups of living cells exhibit the same behavior as groups of dead cells among a
background of living cells. In this cellular automaton, a living cell survives if it has 3, 4, 6, 7, or 8
neighbors and a dead cell becomes alive when it has 3, 6, 7, or 8 neighbors (otherwise, a cell remains in
the same state). Although the day and night rule set is classified as a chaotic cellular automaton, it
behaves very differently from Conway's original rules because of its unique properties. Figure 7 shows
that the population dynamics of this rule set are unusual in that each initialization leads quickly to a
different stable point. The rates of change also vary among initializations, as seen in Figure 8. In
addition, all versions of the simulation show a constant decrease in rate of change.
Population Level Over Time
120
10.00%
20.00%
30.00%
40.00%
50.00%
60.00%
70.00%
80.00%
90.00%
% Living Cells
100
80
60
40
20
0
Time Step
Figure 7. The concentrations of living cells for the day and night rule set quickly stabilize at different values,
depending on the initial concentration. This behavior significantly differs from the standard set of rules for the
game of life.
% Change From Previous Time
Rate of Change Over Time
40
10.00%
20.00%
30.00%
40.00%
50.00%
60.00%
70.00%
80.00%
90.00%
35
30
25
20
15
10
5
0
Time Step
Figure 8. In most cases, the rates of change for the day and night rule set changes rapidly based on the initial
concentration of living cells.
The cellular activity explains the varying optimum population levels. At the start, there is no
dramatic population decrease. Instead, the chaotic structures gradually coalesce into large regions of
living or dead cells (see Figure 9) with constantly shifting boundaries and activity that mirrors that of
other regions.
Figure 9. One of the common outcomes for the day-and-night rule set, in which living cells and dead cells form
connected structures.
The primary cause for Day and Night's uniqueness is the way dead cells exhibit the same
behaviors as living cells. Because of this, the amount of living cells does not affect the population
dynamics in any particular simulation as much as in Conway’s original rule set. If there are fewer
living cells, there is a larger population of dead cells behaving the same way. Unlike for Conway's rule
set, the rule set for Day and Night does not define a small range of numbers of neighbors required for
survival (or birth). So, all initializations stabilize relatively quickly without huge dieoffs due to
overpopulation or underpopulation.
3.1.2 Static Rulesets
Maze
Maze (Cellular Automaton, n.d.) is a rule set that, in a few time steps, expanding into a pattern filling
the world that remains completely static thereafter. In order for a living cell to survive, it requires 1 to 5
living neighbors, while a cell is born when there are exactly 3 neighbors.
Interestingly, this rule creates similar, maze-like patterns with one-cell-wide corridors for most
initializations, a behavior illustrated in Figure 10. As shown in Figure 11, all tested initial
concentrations (except for 90%) quickly approach approximately a 55% population density and then
stay constant. This convergence is similar to that of the standard game of life rule set, as most initial
concentrations are able to create the full pattern. As expected, the rates of change (see Figure 12)
quickly drop to 0% once the pattern is complete.
Figure 10. An illustration of the maze rule set.
Population Level Over Time
100
90
10.00%
20.00%
30.00%
40.00%
50.00%
60.00%
70.00%
80.00%
90.00%
% Living Cells
80
70
60
50
40
30
20
10
0
Time Step
Figure 11. Percentages of living cells for the maze rule set approach approximately the same value for most
tested initial concentrations except for 90%.
Rate of Change Over Time
% Change From Previous Time
100
90
10.00%
20.00%
30.00%
40.00%
50.00%
60.00%
70.00%
80.00%
90.00%
80
70
60
50
40
30
20
10
0
Time Step
Figure 12. Rate of change for the maze rule set confirms that the changes are rapid in the first few time steps,
but the system soon becomes completely stable.
The resemblance to the population dynamics of the game of life even includes an initial
population drop caused mainly by the range of numbers of living neighbors required for survival.
Meanwhile, the survival rule also makes the maze rule set static, as its living cells are far more tolerant
and unlikely to die. This is similar to the quick stabilization of the day and night rule set due to the
range of its survival rule.
Walled Cities
Walled cities is another stable rule set that causes cells to form into polygonal, city-like structures and
then cease to expand, yet continue to fluctuate within the city-like structures. Survival of a cell requires
2 to 5 neighbors, while 4 to 8 neighbors are needed for cell birth.
As shown in Figure 13, the simulations witnessed an initial population drop for all
initializations before most populations stabilized at approximately 50%. However, the populations
continue to fluctuate afterwards as expected. This was actually a result of continued city expansion as
still-expanding structures came into contact with others. The random distribution of initial cells created
these additional seeds for further expansion, which often caused cities to fill up the world and create a
single mass of chaotic activity. This pattern does not apply to the initial concentrations of 10%, 20%,
and 90%, since the populations with those initializations did not have enough seeds for uncontrolled
city expansion. These initializations stabilized at different population levels as their cities stopped
growing. The pattern is somewhat similar to the maze rule set and the original game of life rule set due
to its initialization threshold and convergence of population levels.
The level of activity in the walled cities rule set is closer to the original game of life than to the
maze rule set. Unlike the static configurations seen only after a few time steps with the maze rule set,
all initializations for this variant within the previous range of acceptable initial concentrations again
reach the same asymptote of approximately 40% (see Figure 14). Again, the initial concentrations of
10%, 20%, and 90% result in the population of living cells dropping to lower values relatively fast.
Population Level Over Time
100
90
10.00%
20.00%
30.00%
40.00%
50.00%
60.00%
70.00%
80.00%
90.00%
% Living Cells
80
70
60
50
40
30
20
10
0
Time Step
Figure 13. With most initializations, the percentage of living cells for the walled cities rule set quickly
approaches values around 50% and stabilizes, while some initializations stabilize at lower population levels.
% Change From Previous Time Step
Rate of Change Over Time
120
10.00%
20.00%
30.00%
40.00%
50.00%
60.00%
70.00%
80.00%
90.00%
100
80
60
40
20
0
Time Step
Figure 14. The rate of change over time for the walled cities rule set indicates that while the population of living
cells stabilizes in the total number of cells, the system keeps changing from one time step to another.
These behaviors exist mainly because of the initial random distribution of cells. Under certain
conditions, the simulation does create the clusters of cells that expand to fill small city-like structures
that are characteristic of this variant. Despite the initial die-offs seen in Figure 13, the surviving living
cells for most initializations still managed to expand into world-filling cities with the similar amounts
of chaotic activity within them.
Figure 15. Illustrations of the walled-cities rule set. In the first image, the city-like structures quickly stabilize
but the structures keep changing within their boundaries. In the second, the city has expanded so much that the
world is filled with chaotic activity.
3.2
3-State Game of Life
The 3-state version of Conway’s game of life uses two distinct living states. For example, the two
distinct living states may represent two species or social groups. At the beginning of the simulation, as
with the single living state automata, states are randomly assigned to cells based on specified initial
percentages of the entire world. A specified proportion of the living states gets the first living state,
whereas the rest get the second one. The cellular automaton progresses through time steps in a similar
way as in the original game of life: Cells need either 2 or 3 neighbors to survive, and dead cells with 3
neighbors become living cells (birth). The only difference is that the state of the newborn cell now
depends on its neighbors; whichever cell type makes up most of the 3 living neighbors is assigned to
the new cell. Of course, other rules may be implemented and this is certainly one of the interesting
areas to explore. However, this paper will consider this simple variant, sometimes referred to as the
immigration game.
Instead of testing various initial percentages of living cells, the 3-state simulation tests the effect
of differences in initial populations of the two cell types on the population dynamics of the cellular
automaton. To accomplish this, the simulation uses a total living cell initial percentage of 20%, which
was shown to be a relatively stable initialization for the game of life in Section 4.1. Pairs of starting
percentages for each species were tested based on their initial percentage difference. For example, a 0%
difference between the species means the initial concentrations were both 10%, while an 18%
difference means the initial concentrations were 2% and 16%.
Figure 16. A common result of a 3-state game of life in which cell masses of different species compete with
each other. Each species is shown with a different symbol.
Because survival and birth rules are the same, the behavior of the simulation is similar to that of
the original game of life. However, the addition of a second species (represented in the simulations by
caret symbol ‘^’) allows for more interesting interpretations of otherwise standard automata behaviors.
At the start of the simulation, as the randomly distributed cells either die or start multiplying, each
species starts to overtake different areas of the world until they coalesce into homogenous mobile
masses of cells, as shown in Figure 16. Meanwhile, isolated cells among a different species quickly die
out because they lack the numbers to “convert” new cells.
Population Level Over Time I
Initial Difference: 0%
12
% Living Cells
10
10.00%
10.00%
8
6
4
2
0
Time Step
Population Level Over Time II
Initial Difference: 4%
12
% Living Cells
10
8.00%
12.00%
8
6
4
2
0
Time Step
Population Level Over Time III
Initial Difference: 8%
16
% Living Cells
14
12
6.00%
14.00%
10
8
6
4
2
0
Time Step
Population Level Over Time IV
Initial Difference: 12%
18
% Living Cells
16
14
4.00%
16.00%
12
10
8
6
4
2
0
Time Step
Population Level Over Time V
% Living Cells
Initial Difference: 16%
20
18
16
14
12
10
8
6
4
2
0
2.00%
18.00%
Time Step
Figure 17. Graphs of population changes with different initial concentrations for each species show little
correlation between the population levels of both species and different rates of change.
Although the two cell types appear to interact with each other, the population over time graphs
(Figure 17) suggest otherwise. In all five scenarios, the population changes of the two species have no
apparent direct effect on each other, even when one species significantly outnumbers the other. In fact,
in every instance (except the 0% initial difference scenario) the smaller population stays relatively
stable while the species with a high initial concentration has a nearly constant population decrease. In
the 4% difference scenario, the two populations even converge.
The lack of influence exerted by each population on the other can be explained by the lack of
direct interactions between the species. In the simulation, the only instance where living cell type was
relevant was during cell birth. Because of this, species are never able to directly attack or otherwise
interact with each other; they can only expand into empty regions of the world. Meanwhile, the
unexpected decline of the high concentration species and relative stability of the disadvantaged species
is related to the behavior of the normal game of life. In the earlier tests, populations almost always
undergo a gradual decline until flattening out. Although the high concentration species has more
opportunities to multiply and prevent the other cell type from multiplying, their higher concentration
also means they are more prone to overpopulation. Meanwhile, any cells of the other species that
survived the game of life’s initial population decline would likely not be in danger of overpopulation or
would be found in stable structures.
4
Summary and Conclusions
This paper described the results of a series of tests run on various cellular automata to study their
population dynamics. A C++ program was used to simulate Conway’s game of life, and several its
variants, including the rule sets day and night, maze, walled cities, and immigration game (a 2-color
version of the game of life). For each single state rule set, the population and rate of change over time
was tested with a range of initial living cell concentrations.
The classic game of life appeared to have an optimum population and activity level that most
initial population concentrations falling within a certain range converge upon. This was probably due to
the restrictive range of values for the survival rule. In terms of behavior, the game of life appeared to
have a more diverse range of structures than the day and night rule set. These structures were relatively
common. The day and night rule set causes dead cells among living cells to behave like living cells
among dead cells. Because of this symmetrical death-life relationship, the population patterns were
different from the game of life. Each initialization caused the population to rapidly stabilize at different
levels instead of converging upon an asymptote. The rates of change were also diverse but all showed a
constant decrease in activity due to the stabilization.
The stable rule sets, maze and walled cities, resembled the game of life because of the existence
of an optimum population level that most initializations approach. Because they form static or nearly
static patterns, the activity levels quickly drop to low levels. But while the maze rule set is a faststabilizing rule with a tolerant survival rule (like the day and night rule set), the walled cities rule set is
somewhat more restrictive and needs to grow after an early die-off (like the game of life). Yet, with
most initializations, the surviving cells managed to expand to fill the entire world. In addition, after the
simulations finished growing, there remained a constant level of activity within the cell masses.
The 3-state version of the game of life featured two species of living cells. Their population
patterns did not appear to have direct influence on each other, likely due to their interactions being
limited to influencing the birth of new cells. However, the simulations were able to produce interesting
behaviors such as competitive expansion by cells of different species. In addition, very different
starting percentages of different species surprisingly did not lead to extinction of one, but generally
caused the advantage to be offset by sensitivity to survival pressures. In future work, it would be
interesting to explore more complex types of interaction between the two or more species, providing an
interesting tool for simulating systems that resemble biological and social systems, such as the
predator-prey interaction. This can be done by modifying the rules.
In addition to categorizing cellular automata based on their appearance and behavior, population
dynamics are also important to their classification. The patterns seen in the project include unified
optimum population/activity levels and initialization-dependent population levels. These had much to
do with the rules, which may have forced convergence through a restrictive survival requirement, or
made life and death symmetrical, causing cells to be less affected by survival pressures. Also, the rules
with more tolerant survival rules showed more rapid stabilization, while the others slowly recovered
from initial population drops and slowly stabilized. Another characteristic was based on the existence a
specific range of initializations that converge upon a population level. Again, this appears to be
dependent on the survival rule, as the tolerant maze rule set created only one outlier, while the
Conway’s original rule set and the walled cities rule set featured several initializations that could not
expand as much as most initializations after the initial die-off. Finally, when additional states are
available, a range of new phenomena can be observed, including competition and basic pressures
targeting individual species.
A wide variety of behaviors can be produced using cellular automata with simple rules
determining survival and birth. Survival pressures seem to play an important role in determining the
performance of a cellular automaton, such as how easily it recovers from catastrophic events. Some of
these behaviors, like population dynamics, can mimic the behavior of a real ecosystem. Additional
states open up more possibilities for the simulation of artificial life. Future experiments can include
allowing the cell types to directly affect each other. Asymmetrical systems can be set up in which the
species use different rules, possibly mimicking predator-prey relations. In addition, the effects that the
rules have on the behavior of cellular automata warrants further study.
Acknowledgements
The author would like to acknowledge and sincerely thank the following individuals for their valuable
help in making the project possible. The mentor, Dr. Martin Pelikan, for his vital guidance in teaching
the art of programming, creating the simulation program, and writing this research paper. The research
paper advisor, Mr. Michael Hope, for his support and helpful advice concerning the paper. All the
faculty and staff of participating institutions who have made the STARS program possible. Additional
thanks go to LMI Aerospace Inc, D3 Technologies, Hellenic Spirit Foundation, M7 Electro Optics,
Office of the Chancellor-UMSL, Saint Louis University, Washington University, St. Louis Symphony,
Solae LLC, Green Foundation, Monsanto Co., and the Academy of Science of St. Louis for their
support of the STARS program. Martin Pelikan was supported by the National Science Foundation
under grants ECS-0547013 and IIS-1115352. Any opinions, findings, and conclusions or
recommendations expressed in this material are those of the authors and do not necessarily reflect the
views of the National Science Foundation.
References
Bell, D. I. (1997). Day & Night: An Interesting Variant of Life. Retrieved from
http://members.tip.net.au/~dbell/articles/DayNight.zip
Codd, E. F. (1968). Cellular Automata. Academic Press.
Eppstein, D. (2007). Maze (B3/S12345). Retrieved on March 16, 2009.
Gardner, Martin. (1970). Mathematical Games – The fantastic combinations of John Conway's solitaire
game
“life”.
Scientific
American,
223,
120-123.
http://ddi.cs.unipotsdam.de/HyFISCH/Produzieren/lis_projekt/proj_gamelife/ConwayScientificAmerican.htm
Zenil, H. (2010). Compression-based investigation of the dynamical properties of cellular automata and
other systems. Complex Systems, 19 (1).
Hughes, C. (n.d.). Project Euler. Retrieved from http://projecteuler.net
von Neumann, J. (1966). Theory of self-reproducing automata, edited by A.W. Burks, Univ. of Illinois
Press.
Weisstein,
E.
W.
(n.d.).
Cellular
Automaton.
In
Mathworld.
Retrieved
from
http://mathworld.wolfram.com/CellularAutomaton.html
Cellular
Automaton.
(n.d.).
In
LifeWiki.
Retrieved
July
14,
2012,
from
http://conwaylife.com/wiki/Cellular_automaton
Wolfram, S. (2002). A New Kind of Science. Wolfram Media.
Wójtowicz,
Mirek.
(2001).
Cellular
Automata
rules
lexicon.
Retrieved
from
http://psoup.math.wisc.edu/mcell/rullex_life.html
Appendix A
A.1
Programming Concepts
The main programming ideas studied included the following:
● Input/Output
Input and output functions are responsible for user interaction with the program and
displaying of results. In the simulations, these functions present statistics concerning the
simulation’s behavior, display the simulation at each time interval, and allow the user to
specify starting conditions.
● Data types
Data types define variables by their possible values and the operations one may perform
on them. Examples include integers (such as int), floating point numbers (such as
double), strings (such as string), and Boolean values (such as bool).
● Arithmetic operations
The five basic arithmetic operations are addition, subtraction, multiplication, division,
and modulus (remainder). In the simulations, the operations are used in programs for
counting (for statistics and looping), determining the coordinates of each cell and its
neighbors, and so on.
● Conditionals
Conditionals are if/then logic statements that allow a program to proceed in multiple
ways. These are common statements allowing the simulation to, for instance, mark a cell
as alive or dead depending on the number of neighbors.
● Functions/Passing parameters by reference
Functions are the building blocks of C++ programs and allow them to be more
organized and understandable. Most functions require an input to act upon, generating
an output value (as in mathematical functions) or simply performing a task like
displaying a diagram. Some functions may pass parameters by reference, allowing them
to directly act upon the data that is inputted. In the cellular automata, functions organize
the program into sections of code that perform tasks like displaying and updating the
simulation.
● Loops
While and for loops allow tasks to be performed repetitively based on a logic condition
that must be met during each iteration. In the simulations, such loops are used to make
the program sweep through the rows of cells in succession, repeatedly determining
whether each cell is alive or dead.
● Strings
Strings are variables that store a series of keyboard characters. While they are not used
in the cellular automata, strings are able to store and manipulate user text inputs.
● Vectors
Vectors are a container data type in that they store a one-dimensional list of values that
can each be identified and manipulated individually. In the game of life, a vector of
vectors is used to simulate the two-dimensional matrix of cells that makes up the world.
A.2
Practice Problems
A.2.1 Checking for Divisibility
The objective of this problem is for the program to receive a set of three user-submitted numbers and
check if any of the numbers is divisible by the others, outputting the results. To accomplish this, the
program first asks for three inputs, storing them into variables a, b, and c. Next, the program tests every
possible pairing of values, informing the user if any value can be divided by another to yield a
remainder of zero. Concepts required here include basic input and output statements and conditionals.
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a;
cin >> b;
cin >> c;
if (a % b
cout <<
if (a % c
cout <<
if (b % a
cout <<
if (b % c
cout <<
if (c % a
cout <<
if (c % b
cout <<
== 0)
a << "
== 0)
a << "
== 0)
b << "
== 0)
b << "
== 0)
c << "
== 0)
c << "
is divisible by " << b << endl;
is divisible by " << c << endl;
is divisible by " << a << endl;
is divisible by " << c << endl;
is divisible by " << a << endl;
is divisible by " << b << endl;
return 0;
}
A.2.2 Counting Divisible Numbers
This program finds the solution to problem 1 of Project Euler (Hughes, n.d.). The purpose of the
program is to count the numbers up to 1000 that are divisible by 3 and 5, outputting their sum. This is
accomplished with a for loop that updates the sum (using sum+= i) for every multiple of 3. A second
for loop does the same for the multiples of 5 but only updates the sum when the number is not also
divisible by 3.
#include <iostream>
using namespace std;
int main()
{
int n=1000;
int sum = 0;
int i;
for(i=3; i<n; i+=3)
sum+=i;
for(i=5; i<n; i+=5)
if (i % 3 != 0)
sum+=i;
cout << sum << endl;
return 0;
}
A.2.3 Sum of Even Fibonacci Numbers
Problem 2 of Project Euler (Hughes, n.d.) requires the sum of all even numbers in the Fibonacci
sequence up to four million. To accomplish this, the program uses an independent function that takes
the maximum number (four million) as the input and outputs the sum of the even Fibonacci numbers.
Each term in the Fibonacci sequence is the sum of the previous two, so a While loop is used to
constantly add up the previous numbers (prev and prev2), store the new term to n, update the variables
that store the previous numbers of the sequence, and add n to the sum if it is even until the new value of
n reaches four million. This program demonstrates the use of functions to organize programs and loops.
#include<iostream>
using namespace std;
int fib(int cap)
{
int n, prev=1, prev2=1, total=0;
while(prev+prev2<cap)
{
n=prev+prev2;
prev2=prev; prev=n;
if (n%2==0) total+=n;
}
return total;
}
int main()
{
int cap=4000000;
cout<<fib(cap)<<endl;
return 0;
}
A.2.4 Identifying the Nth Prime
Problem 7 of Project Euler (Hughes, n.d.) asks for the 10001th prime number. This requires a different
method from the previous programs, which test all possible values in succession, as testing a large
number of values for primes is inefficient. The solution program uses a vector with each cell (0, 1, 2...)
representing a number and storing a Boolean true/false value to represent whether each number is a
prime. To perform the calculation efficiently, the sieve of Eratosthenes is used to locate primes. First, a
for loop stores “true” to each element of the vector from 2 to an arbitrary maximum number in the list.
Starting with 2, the program locates its multiples and marks them as non-primes. It then repeats the
process with every subsequent prime. Finally, a for loop counts the number of elements marked as
primes.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int lim; cin>>lim;
int i,j;
vector <bool> primes(lim);
primes[0]=false; primes[1]=false;
for(i=2; i<=lim;i++)
primes[i]=true;
for(i=2;i<=lim; i++)
if(primes[i])
for(j=2*i; j<=lim; j+=i)
primes[j]=false;
int n=0;
for (i=2; i<=lim; i++)
{
if(primes[i])
n++;
if(n==10001)
{
cout<<i<<endl;
return 0;
}
}
}
© Copyright 2026 Paperzz