YACE Batches runyace.bat, stopyace.bat - for running YACE 0.01 on a ramdisk chartout.bat - displays time vs score for YACE 0.02 out directory chartsta.bat - displays time vs score for YACE 0.03/0.04/1.0 status dir benchkot.bat - produce "koth" bench/listing report, for YACE 1.0 These two batch files are for YACE 0.01... --------------- cut ---- runyace.bat -------------------------- :: run yace.exe on ramdisk :: 8/23/00 WTN @echo off set harddisk=d: set ramdisk=f: if not exist %ramdisk%\nul goto noramdisk if not exist %harddisk%yace.exe goto noyace :: if cycle.txt exists, assume this is a restart, :: edit yace.cfg file appropriately :: REQUIRES qbasic.exe on the path! if not exist cycle.txt goto runyace echo Updating yace.cfg file... echo>temp$-.bas :on error goto exitbas echo>>temp$-.bas open "cycle.txt" for input as #1 echo>>temp$-.bas input #1,cycle:close:cycle=cycle+2 echo>>temp$-.bas open "yace.cfg" for input as #1 echo>>temp$-.bas open "yace$-.cfg" for output as #2 echo>>temp$-.bas while not eof(1):line input #1,a$ echo>>temp$-.bas if not instr(a$,"create_new_population")=0 then echo>>temp$-.bas a$="create_new_population=0" echo>>temp$-.bas end if echo>>temp$-.bas if not instr(a$,"starting_cycle")=0 then echo>>temp$-.bas a$="starting_cycle="+ltrim$(rtrim$(str$(cycle))) echo>>temp$-.bas end if echo>>temp$-.bas print #2,a$:wend echo>>temp$-.bas exitbas: close:system qbasic.exe /run temp$-.bas copy yace$-.cfg yace.cfg > nul del yace$-.cfg del temp$-.bas ::::: :runyace if not exist %ramdisk%\yace\nul echo Creating RD directories... if not exist %ramdisk%\yace\nul md %ramdisk%\yace if not exist %ramdisk%\yace\valhalla\nul md %ramdisk%\yace\valhalla if exist %ramdisk%\yace\*.red echo Removing RD redcode... if exist %ramdisk%\yace\*.red del %ramdisk%\yace\*.red if exist %ramdisk%\yace\valhalla\*.red del %ramdisk%\yace\valhalla\*.red echo Copying program and config file to RD... copy yace.exe %ramdisk%\yace > nul copy yace.cfg %ramdisk%\yace > nul if exist *.red echo Copying redcode to RD... if exist *.red copy *.red %ramdisk%\yace > nul if exist valhalla\*.red copy valhalla\*.red %ramdisk%\yace\valhalla > nul echo Changing to %ramdisk%\yace and running evolver... %ramdisk% cd \yace ::: yace.exe ::: echo Copying results to harddisk %harddisk% ... :: because of possible stopping method... attrib cycle.txt -r if exist %harddisk%cycle.txt attrib %harddisk%cycle.txt -r copy cycle.txt %harddisk% > nul copy *.red %harddisk% > nul if not exist %harddisk%valhalla\nul md %harddisk%valhalla copy valhalla\*.red %harddisk%valhalla > nul %harddisk% ::: all done cls goto end :noramdisk echo ERROR: ramdisk %ramdisk% does not exist! goto configmsg :noyace echo ERROR: %harddisk%yace.exe does not exist! :configmsg echo Edit batch file or configure system. :end --------------------------- cut ------------------------ ------------------ cut ----- stopyace.bat --------------- :: cause yace to terminate :: 8/21/00 WTN @echo off set ramdisk=f: if not exist %ramdisk%\yace\cycle.txt attrib cycle.txt +r if exist %ramdisk%\yace\cycle.txt attrib %ramdisk%\yace\cycle.txt +r echo. echo When YACE stops press any key... echo. pause>nul if not exist %ramdisk%\yace\cycle.txt attrib cycle.txt -r if exist %ramdisk%\yace\cycle.txt attrib %ramdisk%\yace\cycle.txt -r cls ------------------- cut -------------------------- This batch is for YACE 0.02, it sorts and charts the out warriors to give a graphical picture of progress... ------------ cut --------- chartout.bat ---------------------- :: display yace 0.02 out directory graphically :: put in yace root directory, requires qbasic.exe :: note - for windows 95 - for other dos-OS modify :: d$=mid$(a$,29,15) to correspond with the position :: of the date/time in the output of the dir command. :: by Terry Newton, last mod Sept 7 2000 @echo off if exist out\nul goto ok echo can't find out directory goto end :ok :: create a date-ordered list to process... dir out\*.red /od /-p |find "RED" > outlist.tmp :: create a qbasic program to process the list... echo> chart$.bas :on error goto X echo>>chart$.bas open "outlist.tmp" for input as #1 echo>>chart$.bas open "progress.txt" for output as #2 echo>>chart$.bas ?#2,"filename date time score" echo>>chart$.bas ?#2,"------------ -------- ------ -----"; echo>>chart$.bas ?#2,":----=----=----=----=----=----=:" echo>>chart$.bas while eof(1)=0:line input #1,a$ echo>>chart$.bas s$=mid$(a$,4,5):d$=mid$(a$,29,15) echo>>chart$.bas f$=lcase$(left$(a$,8))+".red" echo>>chart$.bas ?#2,f$;" ";d$;" ";left$(s$,3); echo>>chart$.bas ?#2," :"; echo>>chart$.bas r=int((val(s$)/30000)*30) echo>>chart$.bas s$=left$("******************************",r) echo>>chart$.bas s$=left$(s$+space$(30),30)+":" echo>>chart$.bas ?#2,s$:wend echo>>chart$.bas ?#2,"------------------------------------"; echo>>chart$.bas ?#2,":----=----=----=----=----=----=:" echo>>chart$.bas X:close:system :: run it... qbasic /run chart$ del chart$.bas del outlist.tmp :: report in progress.txt, list it type progress.txt :: to use list.com comment(::) above line :: and uncomment the next two lines ::list progress.txt ::cls :end ------------------------ cut ---------------------------- Here's a version for Yace 0.03/0.04... --------------- cut --------- chartsta.bat ------------------- :: CHARTSTA.BAT - for yace 0.03 or 0.04 :: displays performance of status warriors over time :: outputs plaintext to screen and "progress.txt" file :: outputs linked html to "status\progress.htm" file :: put this in yace's bin directory and run from there. :: This is for Windows 95's dir command, for other OS's :: you may have to play with the "d$=mid$(a$,29,15)" part :: Requires QBASIC.EXE "on the path" to run :: By Terry Newton, last mod Oct.9,2000 @echo off if exist status\nul goto ok echo can't find status directory goto end :ok dir status\*.red /od /-p |find "RED" > outlist.tmp echo> chart$.bas :on error goto X echo>>chart$.bas open "outlist.tmp" for input as #1 echo>>chart$.bas open "progress.txt" for output as #2 echo>>chart$.bas open "status\progress.htm" for output as #3 echo>>chart$.bas s1$="filename date time score" echo>>chart$.bas s2$="------------ -------- ------ -----" echo>>chart$.bas s2$=s2$+":----=----=----=----=----=----=:" echo>>chart$.bas ?#2,s1$:?#2,s2$ echo>>chart$.bas ?#3,"" echo>>chart$.bas ?#3,"Progress Report" echo>>chart$.bas ?#3,"
"
echo>>chart$.bas ?#3,s1$:?#3,s2$
echo>>chart$.bas while eof(1)=0:line input #1,a$
echo>>chart$.bas s$=left$(a$,5):d$=mid$(a$,29,15)
echo>>chart$.bas f$=lcase$(left$(a$,8))+".red"
echo>>chart$.bas ?#2,f$;"  ";d$;"  ";left$(s$,3);"  :";
echo>>chart$.bas ?#3,"";f$;"";
echo>>chart$.bas ?#3,"  ";d$;"  ";left$(s$,3);"  :";
echo>>chart$.bas r=int((val(s$)/30000)*30)
echo>>chart$.bas s$=left$("******************************",r)
echo>>chart$.bas s$=left$(s$+space$(30),30)+":"
echo>>chart$.bas ?#2,s$:?#3,s$:wend
echo>>chart$.bas s1$="------------------------------------"
echo>>chart$.bas s1$=s1$+":----=----=----=----=----=----=:"
echo>>chart$.bas ?#2,s1$:?#3,s1$
echo>>chart$.bas ?#3,"
" echo>>chart$.bas X:close:system qbasic /run chart$ del chart$.bas del outlist.tmp type progress.txt :end ------------------------- cut -------------------------------- The following big batch benchmarks all "koth" warriors against a selected testset. Tested with YACE 1.0 under Windows 95, it should work with versions 0.03 and 0.04 also. Pmars, qbasic, choice and find com/exe files must be in one of the directories listed in autoexec.bat's path line, and sufficient environment space must be available. Makes a copy of all redcode in koth before benchmarking, so it can run while yace is evolving. Place this batch in the "bin" directory and run from there. After running successfully (good luck!) kothrep.txt should contain charted benchmarks and listings of all koth warriors. -------------------- cut, benchkot.bat ----------------------- :: BENCHKOT.BAT for yace 1.0, coresize 800 :: benchmarks all koth warriors against selected testset :: produces report with listings and benchmarks :: requires pmars, choice, find and qbasic (windows 9x) :: by Terry Newton, December 19 2000 @echo off if .%1==.SuB goto %2 :: alter these as needed... set koth=koth set rnds=100 set pmars=pmars -b -s 800 -p 800 -c 8000 -l 20 -d 20 -r %rnds% -f set report=kothrep.txt :: suppress warnings using ctty if suppress=on set suppress=on :: echo. echo Pick Benchmark... echo 1 - Franz echo 2 - Koenigsstuhl echo 3 - SourceForge RC Tiny echo Q - Quit this batch choice /c:123Q >nul if errorlevel 4 goto quit if not errorlevel 1 echo No choice.com if not errorlevel 1 goto end ::must be relative paths.. if errorlevel 1 set bench=testset\franz if errorlevel 2 set bench=testset\koenig~1 if errorlevel 3 set bench=testset\srcforge md -mybench if exist -mybench\nul goto bench2 echo Can't make temp dir, exiting... goto end :quit cls goto end :bench2 echo. echo Benchmarking all %koth% warriors against %bench% if not .%suppress%==.on echo To avoid halting don't press a key echo. cd -mybench copy ..\%koth%\*.red *. >nul for %%a in (*) do call %0 SuB DoBench %%a del battle.out goto ProduceReport :DoBattle ::compensate for benchmark warriors without names... find /i ";name" < %4 > nul if errorlevel 1 goto NoNameBattle >>battle.out %pmars% %3 %4 goto end :NoNameBattle ::see if it has program, use that... find /i ";program" < %4 >getprog.bat if errorlevel 1 goto NoProgramEither echo>program.bat @echo off echo>>program.bat set name=%%1 %%2 %%3 %%4 call getprog.bat echo>temp.red ;name %name% type %4 | find /v /i ";program" >>temp.red >>battle.out %pmars% %3 temp.red goto end :NoProgramEither ::let pmars call it unknown >>battle.out %pmars% %3 %4 goto end :DoBench echo Testing warrior %3... if exist battle.out del battle.out if .%suppress%==.on ctty nul for %%b in (..\%bench%\*.red) do call %0 SuB DoBattle %3 %%b if .%suppress%==.on ctty con echo>name.bat @echo off echo>>name.bat set name=%%1 echo>>name.bat if not .%%2==. set name=%%name%% %%2 echo>>name.bat if not .%%3==. set name=%%name%% %%3 echo>>name.bat if not .%%4==. set name=%%name%% %%4 find /i ";name"<%3>getname$.bat call getname$.bat echo>rank$.bas :on error goto X echo>>rank$.bas open "battle.out" for input as #1:open "%3.rep" for output as #2 echo>>rank$.bas ? #2, "Opponent Scores Results Performance of %name%" echo>>rank$.bas ? #2, "-------- ------ ------- ---------=---------=---------=---------=" echo>>rank$.bas L:line input #1,a$:if instr(a$,"scores ")=0 goto L echo>>rank$.bas line input #1,b$:line input #1,c$ ':if instr(a$,"%name%")=0 goto L echo>>rank$.bas w$=left$(b$,instr(b$," by ")):w$=left$(w$+" ",15)+" " echo>>rank$.bas ms=val(right$(a$,len(a$)-instr(a$,"scores ")-6)):ts=ts+ms echo>>rank$.bas os=val(right$(b$,len(b$)-instr(b$,"scores ")-6)):no=no+1 echo>>rank$.bas ms$=left$(str$(ms)+" ",4):os$=left$(str$(os)+" ",4) echo>>rank$.bas re$=right$(c$,len(c$)-8):re$=left$(re$+" ",12) echo>>rank$.bas ? #2,w$;os$;ms$;" ";re$;:if os+ms=0 or ms=0 goto N echo>>rank$.bas ra=(ms/(%rnds%*3))*40:for z=1 to ra:? #2,"*";:next z echo>>rank$.bas N:? #2,"":goto L echo>>rank$.bas X:? #2,"-------- ------ ------- ---------=---------=---------=---------=" echo>>rank$.bas if not no=0 then ? #2,"Adjusted Score:";int(((ts/no)/(%rnds%/100))*10)/10 echo>>rank$.bas close #1:close #2:system qbasic /run rank$.bas type %3.rep goto end :ToC find "Adjusted Score" < %3.rep > getscore.bat echo>adjusted.bat @echo off echo>>adjusted.bat set score=%%2 call getscore.bat echo>>..\%report% %3 %score% goto end :AppendDetails echo>>..\%report% --------------------------------------------------- echo.>>..\%report% echo>>..\%report% File %3 echo.>>..\%report% type %3.rep >>..\%report% echo.>>..\%report% type %3 >>..\%report% echo.>>..\%report% goto end :ProduceReport echo>..\%report% KOTH Listings and Benchmarks echo>>..\%report% ============================ echo.>>..\%report% for %%c in (*) do call %0 SuB ToC %%c echo.>>..\%report% for %%d in (*) do call %0 SuB AppendDetails %%d echo>>..\%report% --------------------------------------------------- :: done! back out and remove temps echo. echo File %report% created. cd .. for %%e in (-mybench\*.*) do del %%e rd -mybench :end ------------------------- cut --------------------------------