neighboring cells algo try

This commit is contained in:
isabe 2024-05-05 11:49:04 +02:00
parent 4ba0328373
commit f2ca79f8bd
1 changed files with 18 additions and 0 deletions

View File

@ -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;
}
}