The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in
1970. It is the best-known example of a cellular automaton.
The “game” is a zero-player game, meaning that its evolution is determined by its initial state, needing no
input from human players. One interacts with the Game of Life by creating an initial configuration and
observing how it evolves.
Rules in the game of life
For a space that is ‘populated’:
- Each cell with one or no neighbors dies, as if by loneliness.
- Each cell with four or more neighbors dies, as if by overpopulation.
- Each cell with two or three neighbors survives.
For a space that is ‘empty’ or ‘unpopulated’
- Each cell with three neighbors becomes populated.
You can download my simple implementation of Game of Life in Java. You can open the project in Netbeans or you can just copy the src directory and edit them in your own if you don’t have Netbeans or you don’t want to use Netbeans.
The source code consists of the following classes:
- Cell.java -This class is responsible for representing a single cell in the game of life. The following are the states that it has to keep track of and its responsibilities: (1) Keeps track of its state (dead or alive), (2) Keeps track of its neighbors, and (3) Identifies if it will live or die in the next iteration given knowledge of its neighbors
- CellWorld.java – This class is responsible for keeping track of the world where all cells reside. The following are the state that it has to keep track of and its responsibilities: (1) Keeps track of all cells existing in the world, (2) When the CellWorld is created, the number of rows and columns in the world are provided and a Cell is placed in each location in the world, (3) The state of a specific Cell in the world can be set. (4) The CellWorld can be asked to take a single step of iteration which will inform all cells of their neighbors and update their states causing them to either live or die.
- CellWorldCanvas.java – This class is a CellWorld representation in a Java Canvas. The CellWorld knows to draw itself.
- GameOfLife.java – This is the runner class. The main method resides here.
Here is an example screenshot of the program with 9 generations (read pictures from left to right):

Cyrus Game of Life in Java
Enjoy playing the Game of Life.
Hi, when i click to download your source of Game of Life, the browser can’t find it. it says:
“The requested URL /~cyrus/repos/GameOfLife.zip was not found on this server.”
This is my fifth year being in java, but first in graphic, so i really want to test program on my own
Sorry I changed the link, here is the link: http://turing.cs.msuiit.edu.ph/~cyrus/repos/Programs/GameOfLife.zip
Сорри за оффтоп, кто-нить смотрел ролики на ютьюбе про конец света? Ну, про андронный колайдер Ваще страшно!
Довольно интересно конечно. Я немогу подписаться под каждым вашим словом, но в общем соглашусь.
Hi there,
I was trying to get your code but I get page cannot be displayed I tried both links but same result.
Can you please send me the right address or the code if is possible?
Thanks!!!
Sure, i’ll send you the code.
Hola me puedes enviar el código … gracias.
Could you send me your code too?
I sent it already.
Could you send me your code too?
Hi there Can u send me your code too?
Thank you.
can you send me the code to my email? I can’t download it with the link that you provided. I really want to test the program…thanks
thank you !
Works great, thank you.
hi can u send me this code please.
thank you.
had the same issue trying to download from either of the links :S, could you send me the code please
Halo! Blink.. can i see your gameOfLife code.. please send it to my email, ok?
Thank You very much!!
Hi Can you send me code for game of life
hi… can you send me the code too
hello… i need de source code please!!! send it to my e-mail, thanks…….
can u send me a life code but not the applet one?
Can you please send me the code. Thanks
Hey
Blink.. can I have a look at your gameOfLife code.. please send it to my email address, would be great
Thank You so much!
good sir. I cannot download the codes from your given download links. can you send me the code sir. thank you.
Yo your links are broken (as I am sure you know) and I am trying to do some independent programming studies. Please send the code to my email… there are many other codes for this game, but I would like to read yours, as it seems far simpler (in a good way) than the others.
Heya all! THIS IS FOR ANYBODY. NOT JUST THE CREATOR OF THIS PROGRAM. PLEASE HELP! I already posted asking the original poster for the code but this is for anybody who may have it. My email address is nexro00@gmail.com… please and thanks
Hi!
I want to download your code from Game of Life, but the link is broke.
Could you send the code to my e-mail? My email is: viniciuscosta90@gmail.com
Thank you.
Cordially,
Vinicius
Hey, Could you send me the source code ? I would be grateful…
Hey i really want this code…can you send it to my email…thanks
is it too late to ask if you could also send me this code via email?
if you can, thank you so much!
thank you for give all information or help….
hello i want to see the code of the game of life….send on my email
The link doesn’t seem to work.
can you send me your code to email, its quite urgent.
Thanks
i want the conway’s game of life code as soon as possible.
can you mail me the code please.
thank you.
can you send me the link?
If u can sen me the code, trying to do it by myself but i just mess doing the grids :/
I need this code anyone?
Please, kindly send your code. I want to test it. Thanks
im new to programming, and would really like to see how something like this is coded. if you still check up on this i would really like to see your code
thanks
(ps. if you need my email comment me back)
could you please send me your code???
hi buddy,i am new to java,i want to know how the code works..send me the source code plz.
Hi,
Not able to download the Zip, however i was thinking if you have any command line code ( Not the applet one), can you send me?
Hi
Can you please send me your code as well?
Thank you