home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
drdobbs
/
1991
/
04
/
morrow
/
objword.c
< prev
next >
Wrap
Text File
|
1980-03-30
|
512b
|
40 lines
/*** GASystem -- Mike Morrow -- Objective function **/
#include "ga.h"
void objinit()
{
}
FIT_TYPE objective(s, len)
SEQ s;
int len;
{
FIT_TYPE n;
unsigned int i;
static char tgt[] = "HELLOTHERE";
n = 0;
for(i = 0; i < len && i < sizeof tgt - 1; i++)
if(tgt[i] == s[i])
n++;
return n;
}
void objshow(s, len, fitness)
SEQ s;
int len;
FIT_TYPE fitness;
{
printf("%d ", fitness);
while(len--) printf(" %c", *s++);
puts("");
}
void objdumpdone()
{
}