Sunday, January 12, 2014

Conway's Game of Life in Java

Conway's Game of Life was devised by the mathematician John Horton Conway in 1970 as a cellular automaton. Conway created the rules of the game to offer a simplified answer to John von Neumann's question of a self replicating machine.

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.

Jar download:

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
Then, observe the results by navigating in the menu to Game > Play.

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.


  1. The Baccarat Card game Rules - Vegas Casino
    Learn how to play 온카지노 the Baccarat card 바카라사이트 game by playing a card game. We cover the basics of this type of game, including the septcasino player's game of

  2. The King Casino - Herzaman in the Aztec City
    The King Casino in Aztec City is herzamanindir the place where you can find and play for real, real money. bsjeon Enjoy a memorable stay at this one-of-a-kind casino หาเงินออนไลน์

  3. A small share of residents make up the vast majority of} lottery players, in accordance with the North American Association of 아벤카지노 State and Provincial Lotteries. A study on Minnesota’s lottery decided that 71% of its lottery income comes from 20% of its players. A related study on Pennsylvania’s lottery revealed that 79% of the lottery income comes from 29% of its players. Additionally, while further research point out that 77% of lottery players have an income of $25,000 or more, because of this 23% — more than 1 in 5 players — are under that income level. The fee is permitted to ascertain minimal regulatory requirements for the playing industry, and ensure that that|be positive that} state playing licenses are not issued to or held by unsuitable or unqualified people.