Skip to content

Commit

Permalink
Change formula for survive time
Browse files Browse the repository at this point in the history
  • Loading branch information
ceebo committed Nov 8, 2015
1 parent d39fdca commit e5f9275
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions survive.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ main(int argc, char *argv[]) {
int restored;
int firstgen;
int maxgen;
int survivegen;
int prodcells;
int restorefilter=10;
char outpat[100000];
Expand Down Expand Up @@ -63,8 +64,8 @@ main(int argc, char *argv[]) {
restored=0;
firstgen=0;
maxgen=0;
survivegen=0;
for (i=0; i<gens; i++) {
generate(&cells);

// printf("%d %d %d %d\n", i, fail, damaged, restored);

Expand All @@ -89,6 +90,7 @@ main(int argc, char *argv[]) {
if (firstgen == 0) { firstgen = i; maxgen = i + restorefilter + 10; }
} else {
restored++;
survivegen = i;
if (restored>restorefilter) {
if (restored == restorefilter + 1 || i <= maxgen) {
prodcells = cells.ncells - matchcells.ncells;
Expand All @@ -103,14 +105,15 @@ main(int argc, char *argv[]) {

if (fail>150) break;

generate(&cells);
}

if (damaged) {
fflush(stdout);
removeLifeList(&outcells, &matchcells, 0);
makeString(outcells.cellList, outcells.ncells, outpat);

printf("%s %d %d %d %d %s\n", nextpat, damaged, fail, i-fail, prodcells, outpat);
printf("%s %d %d %d %d %s\n", nextpat, damaged, fail, survivegen, prodcells, outpat);
}

}
Expand Down

0 comments on commit e5f9275

Please sign in to comment.