These are minor changes I made to version 0.02 of Martin Ankerl's Yet Another Corewar Evolver, home page: http://martinus.awhs.at/ Note: for version 0.02 only! Disclaimer: Just learning C... An exit mod =========== This mod makes yace easier to terminate without having to press control-c. Add (in yace.c) this line right after the "int main() {" line... FILE * run_enable=0; /* for exit mod (below) */ Add right after the "if (!(current_cycle..." line that follows the /* Save population to disk */ comment near the end... /* Exit mod - 9/8/2000 Terry Newton Upon running, creates "run" in "bin" dir, if this file is removed, say by a "del run" batch, the evolver saves and exits cleanly. */ if (current_cycle==0) { run_enable=fopen("run","w"); if (run_enable==0) { printf("Can't create run file.\n"); exit(1); } else fclose(run_enable); } else { run_enable=fopen("run","r"); if (run_enable==0) { if (current_cycle>0) { save_warriors(warriors, population_size, current_cycle); } exit(0); } else fclose(run_enable); } /* end exit mod */ This is just before the end of the program... } return 0; } With this mod in place, YACE 0.02 can be terminated with the following batch placed in the bin directory... @echo off del run The simulation must run for at least one cycle to create the file, after that the batch will cause yace to terminate and save warriors upon the completion of the current cycle. [note.. this isn't the same as Martin Ankerl's mod that creates "del2stop" in the yace home dir] Unique out name mod =================== In yace 0.02 the filename for a warrior placed in the out directory is determined by its score against the test set, a great idea actually but occasionally a warrior gets the same score as one already in out and the older warrior is overwritten. This mod increases the score by .01 until the resulting filename is unique, up to 100 times then it overwrites anyway (you should really clean out out if it gets to that). These changes are made to yace.c in the status function. Add right after the line that says "void status(const int..."... int nameok; int dupcount; REPLACE the "sprintf(file_name..." line right after "/* print best warrior to file */" with the following code... /* adjust name if it already exists - 9/6/00 Terry Newton */ nameok = 0; dupcount = 0; while (nameok == 0 && dupcount < 99) { sprintf(file_name, "..%sout%sev_%05.0f.red", path_symbol, path_symbol, bestscore_adjusted*100); if (0==(warrior_file=fopen(file_name,"r"))) nameok = 1; else { fclose(warrior_file); dupcount++; bestscore_adjusted += 0.01; } } /* end filename mod */ Next line should be the "if (0==(warrior_file=fopen...." line. All for now. Terry Newton wtnewton@nc5.infi.net http://www.nc5.infi.net/~wtnewton/corewar/evol/