Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Conway's Game of Life

Name: Anonymous 2013-03-26 17:41

I want to try to make this with Java.
http://en.wikipedia.org/wiki/Conway's_Game_of_Life

but I'm not really sure where to start, these are some of my points:

1.- there is a seed to create the random map?
2.- how do i create the grid, maybe a bi-dimensional array?
3.- how to print the next generation?

it would be cool, if you have a open source repo in java, i would like to read it... thanks.

Name: Anonymous 2013-03-26 17:54

>>1

1. Why? Conway of life is cool, because you can program it. But you can try to create a two dimensional hash function. Just feed it some data and the space is filled. Or just use a random distribution of your bidding.

2. Two dimensional array's are only useful, when you make the world wrap around. Make it a torus. This makes it very easy to calculate the next generation. Just shift 8 times the cells to a different direction, sum the layers and you are done.

Otherwise you need to create an effect on the side or let it grow forever, which is sucky with two-dimensional arrays.

3. I don't know, use ncurses? That's what I use.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List