The purpose of this program is to Implement Conway's Game of Life in 64-bit integer space using Python.
-
Consider a 2d grid where each cell is either Alive or Dead
-
In our case
Alive
cells will contain a 1 and dead cells will contain a 0 -
The cells can exist Anywhere in the 64bit Integer space
-
The simulation will start with input from STDIN
-
The input will be a list of (x,y) pairs representing an individual cell in the grid
-
All of the represented cells will be considered
Alive
when the game starts -
Every subsequent
tick
of the simulation is called aGeneration
-
With each generation the existing cells will follow these rules:
- A tally of
Alive
cells will be made around each cell in the grid - That tally will be taken from the 8 cells directly around the
cell
- During the tally
out of range
cells are considered to beDead
- 2 >
alive_neighbors
> 3 If an existingalive
cell meets this criteria it will now be considereddead
- 3 ==
alive_neighbors
If an existingdead
cell meets this criteria it is nowalive
- A tally of
-
Simulation will run 10 generations
-
At the end of 10 generations we will print out the board in life.1.06 format
From the command line this version of game of life is setup to take its initial input from STDIN.
Included in the game
directory is a sample input file named input1.txt
. Using a terminal from
within the game
folder the following command will run the game of life simulation using the test
file as its initial input:
python3 game_of_life.py < input1.txt
Additionally there is a small set of unit tests that have been added to the package that helped navigate some initial POC things as well as acting as basic regression tests as functionality was added. These can be run from the command line in the root directory of the project with the following command:
python3 -m unittest test/testGame.py