Getting fit, Program Fitness Survival

The cats in the attic pretty much decide what I am going to do at any particular time. At the moment I am establishing a fitness algorithm for a self replicating program. What I intend to do is to generate ever more difficult puzzles using the game I created. I am going to allow the program to try and solve the puzzle and if it does, it has a time of solution and the solution matrix, which is checked by the puzzle program for validity. If it faults or fails or runs out of time, it will not replicate. When it replicates it will add something or subtract something at random to change its structure and function at some reasonable interval. I suppose I will make it slow at first and see how that goes.

When the program replicates it competes and it is selected externally to replace an existing program by the speed, reliability, and stability, with a little randomness there too , when it is a push. The external program does not make a fitness selection, it merely supplies the fitness number and the programs must decide between themselves if they survive. I can see I will have to cast the initial framework with some art, but if I am correct in my assumptions, it should just progress forever to more and more reliable solutions.

A psychiatrist once said I was either insane or incredibly smart. I have to question her reasoning, as they are not mutually exclusive or even boolean states. But perhaps only a schizophrenic would see it that way :)

I am always impressed with "gcc" , and here it manages to avoid entanglement with a forward reference that is composed within the reference itself. I saw no other way to do that. It will be interesting to see what types of programs come from this. I just can't imagine what they would be, but it would be a different style of logic from my own or anybody else's , I would guess. Logic is logic and combination of logical functions should bring a solution. With respect to "int size" hell a few days ago, using "uint32_t" is probably the best solution, and saves some acrobatics.

Of course you would need


#include <stdint.h>

If no other header added it. :)


#include <stdio.h> #include <stdlib.h> #include <sys/time.h> typedef struct aFunction aFunction; typedef int (*Fx)(aFunction *lF); /*NULL here, tz not supported */ void seedRandom(void){ struct timeval tv; gettimeofday(&tv, NULL); srand(tv.tv_sec * tv.tv_usec);} struct aFunction{ char T; int DPT; int DPS; int P1; int P2; int P3; aFunction *DP; Fx FP; }; int process(aFunction *lF){ lF->P3=(lF->P1+lF->P2); return (lF->P1+lF->P2);} int main(){ seedRandom(); aFunction lF; lF.P1=rand()%10;lF.P2=rand()%11; lF.FP=process;lF.DP=&lF; printf("Sum of A(%d) and B(%d) = %d\n",lF.P1,lF.P2,lF.FP(&lF)); if ( ( (lF.P1) + ( lF.P2 ) ) == (lF.P3) ) {printf("Apoptosis is avoided!\n");return (0);} return (1); FILE *f,*o;char *fd;char fdd;int c; char cmd[128];fd=&fdd;char fp[30]="rp.c";char fc[30]="rc.c"; o=fopen(fc,"rb"); if(o != NULL){fclose(o);return (-1);} f=fopen(fp,"rb");o=fopen(fc,"wb"); while(fread(fd,1,1,f)){fwrite(fd,1,1,o);} fclose(o);fclose(f);return (system("gcc rc.c -o rc")); }

CHANGED,ADDED: FYI - <time.h> did not have the prototype for gettimeofday(&tv, NULL); and so I am using <sys/time.h>

0 comments:

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen