1. Member
Join Date
Sep 2011
Posts
13
Rep Power
0

## Re: Game of Life , Adam & Eve

Back a few post I "binary" explained how it should be if it is 3 in a row...
Using the paint method first it just paints the one at the top and int he bottom of the one in the center meaning this:
000
111
000

does this

020
000
020

2 = Next Cell to live
It should paint the Dead ones though....

2. ## Re: Game of Life , Adam & Eve

I have checked it yet but my first idea is that a cell needs 4 states. When counting the neighbors only the alive or dying(currently alive but will be dead) are counted, not the dead or coming alive (currently dead but will be alive).

3. Member
Join Date
Sep 2011
Posts
13
Rep Power
0

## Re: Game of Life , Adam & Eve

Why should i count the next one to be alive?
I managed to fix the array issue and with the painting debugging my result is how it should be (Just if i click each cell to change its color depending on its next state):

000 -> 020
111 -> 323
000 -> 020

3 = Next Gen Dead Cell
2 = Next Gen Alive Cell

Which four states would these be and what would I use them for?
Last edited by rapito; 09-24-2011 at 02:46 AM.

4. ## Re: Game of Life , Adam & Eve

I didn't see that you did that by using two arrays. I only used one to keep the cells' state in.

You have too many statics variables. Here are some changes you could make:
Java Code:
```	public  CellEntity cells[][] = new CellEntity[X_CELLARRAY][Y_CELLARRAY];

for (int px=0; px<cells.length ; px++)
for(int py=0; py<cells[px].length; py++)

CellEntity[][] newGen = cells.clone();     // Save current map

for (int px=0; px < cells.length ; px++)
for(int py=0; py < cells[px].length; py++)
cells[px][py].survive(cells, newGen);      // Mark cells in newGen using cells as source

public void survive(CellEntity[][] cells, CellEntity[][] newGen) 	{

int vivas = fam(cells);

public int fam(CellEntity[][] cells) {

int fam=0;
if(x > 0 && x < cells.length-1
&& y > 0 && y < cells[0].length-1  ){```
Last edited by Norm; 09-24-2011 at 04:27 AM.

5. Member
Join Date
Sep 2011
Posts
13
Rep Power
0

## Re: Game of Life , Adam & Eve

I got it working...
This is the zip file containing it:
TDO.zip
I Will edit my first post and post the solution.

For some reason my CellEntity class was behaving as static.
I fixed my issue by creating a 2 dimensional int array with values calculated with the next gen values instead of having the method kill the cloned array of the Cell Entities, then just make the cels suicide or come ti live dependin on the array values!

Thanks for your help Norm! :D
I Really Appreciate it!
I hope i get an A :P ^_^

6. ## Re: Game of Life , Adam & Eve

my CellEntity class was behaving as static.
See the end of my last post

7. Member
Join Date
Sep 2011
Posts
13
Rep Power
0

## Re: Game of Life , Adam & Eve

I tried that too several times, and exatly that same way, got the same results XD

Page 2 of 2 First 12