aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2009-11-30 22:09:03 +0000
committerDimitri Sokolyuk <demon@dim13.org>2009-11-30 22:09:03 +0000
commit398df06131e78e3198fd652d83acea23d22b902d (patch)
treee1f5be1a8e7b29f471fd195ae911660cca6c98e4
parent3e177fc5f1064f6c6d755a5fd3607fbbd1b85a62 (diff)
use highlighting instead of colors
-rw-r--r--weasel.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/weasel.c b/weasel.c
index 4e41160..809cc97 100644
--- a/weasel.c
+++ b/weasel.c
@@ -33,8 +33,6 @@ int population = 1000;
int mutationrate = 100; /* 1/n */
float average;
-enum { NORM, GOOD, BAD };
-
#if 0
const char defaim[] = "METHINKS IT IS LIKE A WEASEL";
const char defalpha[] = " ABCDEEFGHIJKLMNOPQRSTUVWXYZ";
@@ -115,18 +113,16 @@ initpopulation(int length)
void
printcreature(struct creature *c)
{
- int color = NORM;
+ int attr = A_NORMAL;
if (c->locked)
- color = BAD;
- else if (c->fitness > average)
- color = GOOD;
-
- attron(COLOR_PAIR(color));
+ attr |= A_REVERSE;
+ if (c->fitness > average)
+ attr |= A_BOLD;
+ attron(attr);
printw("%1.3f\t%s\n", c->fitness, c->genom);
-
- attroff(COLOR_PAIR(color));
+ attroff(attr);
}
void
@@ -298,13 +294,6 @@ main(int argc, char **argv)
srandom(time(NULL));
initpopulation(strlen(aim));
- if (has_colors())
- start_color();
-
- init_pair(NORM, COLOR_WHITE, COLOR_BLACK);
- init_pair(GOOD, COLOR_GREEN, COLOR_BLACK);
- init_pair(BAD, COLOR_BLACK, COLOR_RED);
-
pthread_mutex_init(&mutexsum, NULL);
pthread_attr_init(&attr);
// pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);