The rules of the game of life are simple. An infinite plane is populated with cells. These cells have only two possible states, alive or dead. Cells surrounded with 0-2 neighbors will die of loneliness.
Likewise, alive cells surrounded with 4-8 neighbors will die of overcrowding.
However, a dead cell surrounded with exactly 3 neighboring alive cells will be born.
Through these simple rules, we can create complex and interesting structures and "lifeforms".
I developed a Java, Swing based implementation of Conway's Game of Life that is available on GitHub.
https://github.com/Burke9077/Conway-s-Game-of-Life
Jar download:
http://mattburke.me/programs/Conway_s_Game_of_Life.jar
The one issue with this implementation is that it is not an infinite plane; the array is defined based on the size of the window. The edges of the window are considered to be permanently dead cells, but it still shows some of the interesting patterns and is a good starting point for anyone looking for an example.
Below is the executable .jar available in the /dist/ folder in the GitHub link above. First we need to fill in some spaces. This can be done by clicking and/or dragging the mouse in the game board or by navigating to Game > Autofill in the menu.
![]() |
User defined points using the mouse |
![]() |
Randomly defined points via Game > Autofill |
The results can be interesting to watch! You can also interact with the board while the game is running, by drawing new points or lines.
No comments:
Post a Comment