/***This function is called at the end of the stochastic realisation***/ /***It writes the locations of all individuals to file***/ /***Written for Drew to analyse for fractal patterns***/ void write_locations(i) int i; { struct individual *current; char filename[150]; FILE *drew; sprintf(filename, "end.%d.%.3lf.dat", i, M1[0]); drew = fopen(filename, "w"); if(!drew) { printf("Couldn't open locations filename: %s\n", filename); exit(1); } current = start; /* fprintf(drew, "%n\n", population_size[0]);*/ fprintf(drew, "%d\n%d\n", population_size[0], population_size[1]); while(current!=NULL) { /* if(current->species == organism)*/ { fprintf(drew, "%lf\t%lf\t%d\n", current->xpos, current->ypos, current->species); fflush(drew); } current = current->next; } fclose(drew); }