#include <time.h>
#include <stdio.h>
#include <strings.h> 
#include <stdlib.h>
#include "minfo.h"
#include "ga.h"

char * makePath(struct minfo *theMatrix,
		struct gastuff *theGA,
		time_t startTime);

int main(int argc, char * argv[])
{
    static FILE *mfile, *pfile;
    struct minfo theMatrix; // ha ha
    static struct gastuff theGA;
    time_t startTime;

    static char *path;
    int plen;
    int score = -999999;

    time(&startTime);

    srand48(startTime);

    if (!parseMatrix(stdin, &theMatrix))
    {
	(void) puts ("ES");
	exit (-1);
    }
    // dumpMatrix(&theMatrix);
    buildMinfo(&theMatrix, 0);

    // plen = strlen(plen);
    // score = checkPath(&theMatrix, path, plen, 0);
    path = makePath(&theMatrix, &theGA, startTime);

    // puts ("---");
    (void) puts (path);
    exit(0);
    return -1; // should never get here but gcc complains
}

char * makePath(struct minfo *theMatrix,
		struct gastuff *theGA,
		time_t startTime)
{
    init_ga(theMatrix, theGA);
    return theGA->bestpath;
}
