neighboring cells algo try
This commit is contained in:
parent
4ba0328373
commit
f2ca79f8bd
|
|
@ -130,6 +130,24 @@ public class Simulator extends Thread {
|
|||
}
|
||||
}
|
||||
if (cell==1) {
|
||||
for(int n=0; n<2;n++) {
|
||||
for (int m=0; m<2; m++) {
|
||||
int xLocal=x-1+n;
|
||||
int yLocal=y-1+m;
|
||||
int borderCell= world[xLocal][yLocal];
|
||||
if (x!=xLocal && y!=yLocal) {
|
||||
if(borderCell==1) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count<2) {
|
||||
world[x][y]=0;
|
||||
}
|
||||
if (count>3) {
|
||||
world[x][y]=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue