aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2009-10-05 02:24:27 +0000
committerDimitri Sokolyuk <demon@dim13.org>2009-10-05 02:24:27 +0000
commit7411105e30e24a98d187d5e7f324d11d7dd7ea56 (patch)
tree6be5cfc3f333e4dce4b25bfd11a28e82cf84be8f
parent88030754dbe0f55deed90428e4c71f8ecf8d3bc3 (diff)
cleanup
-rw-r--r--weasel.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/weasel.c b/weasel.c
index 0dd341f..21cd3a2 100644
--- a/weasel.c
+++ b/weasel.c
@@ -110,6 +110,7 @@ printpopulation(int maximal)
break;
}
printw("\n");
+ clrtobot();
}
struct creature *
@@ -225,7 +226,7 @@ main(int argc, char **argv)
extern int LINES;
int population = 1000;
int mutationrate = 100; /* 1/n */
- int nthreads;
+ int nthreads = population / 5;
int i, c, t;
while ((c = getopt(argc, argv, "m:p:t:")) != -1)
@@ -243,6 +244,7 @@ main(int argc, char **argv)
population = i;
else
usage();
+ nthreads = population / 5;
break;
case 't':
i = atoi(optarg);
@@ -267,7 +269,6 @@ main(int argc, char **argv)
args.population = population;
args.mutationrate = mutationrate;
- nthreads = population / 10;
if (!nthreads)
nthreads = 1;
threads = calloc(nthreads, sizeof(pthread_t));
@@ -290,8 +291,8 @@ main(int argc, char **argv)
pthread_mutex_destroy(&mutexsum);
free(threads);
- printw("\nhalted after %d generations of %d population (%d births)\n",
- nthreads * i / population, population, nthreads * i);
+ printw("\nhalted after %d generations with population of %d (%d births, %d simultaneous)\n",
+ nthreads * i / population, population, nthreads * i, nthreads);
refresh();
endwin();