From 398df06131e78e3198fd652d83acea23d22b902d Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 30 Nov 2009 22:09:03 +0000 Subject: use highlighting instead of colors --- weasel.c | 23 ++++++----------------- 1 file 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); -- cgit v1.2.3