Skip to content

clovisphere/cellular-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

Cellular Simulation (a.k.a a Game of Life example)

game-of-life-preview

If you don't know about Conway's Game of Life, start by reading this article.

After that, read or go through any of the 3 recommended videos/articles below:

  1. Daniel Shiffman's Coding Challenge #85
  2. How to write Conway's "Game of Life" in Python
  3. What are Cellular Automata by javidx9

Instructions

Problem

You are tasked with creating a program capable of generating a random starting cellular matrix based
upon a given seed value. The program must then solve and print out the next 100 time-steps of a
modified game of life simulation. The simulation is guided by a handful of simplistic rules that will result
in a seemingly complex simulation of cellular organisms.

Below is an example starting cellular matrix when given an input of 10 rows and 20 columns:

	00.0.00....0000..000
	000..0.0.0.0000.0.0.
	00000...0000...0.0.0
	..0.00.0....0000..00
	.0.0..00....0....0..
	..00.00.00..0000....
	0....00..0.0...00..0
	.00..00.0..0...0.0.0
	.00.0.00..00....0000
	0.00..0......00.000.

Direction

Develop a program capable of generating a random starting cellular matrix of a size directed by the user.
Your generator must abide by the following rules:
1) The starting matrix must only contain the following symbols:
a. Periods ‘.’ to signify currently “dead” cells.
b. Capital O’s to signify currently “alive” cells.
2) The starting matrix must be randomly generated making use of the seed value provided by the
user. As such:
a. Matrices generated using identical seeds should be identical.
b. Matrices generated using difference seeds should be different.

Using this starting cellular matrix, your program should then simulate the next 100 steps of a simulation
that uses the following rules to dictate what occurs during each time step:
1) Any position in the matrix with a period ‘.’ is considered “dead” during the current time step.
2) Any position in the matrix with a capital ‘O’ is considered “alive” during the current time step.
3) If an “alive” square has exactly two, three or four living neighbors, it continues to be “alive” in
the next time step.
4) If a “dead” square has an even number greater than 0 living neighbors, it will be “alive” in the
next time step.
5) Every other square dies or remains dead, causing it to be “dead” in the next time step.
Requirements

Releases

No releases published

Packages

No packages published

Languages