100 REM Benchmark a directory of warriors against a benchmark set
102 REM by WTN 7/15/09 modified 8/22/09
110 REM ---------------------------------------------------------------
120 usewin=1   'set to 1 for Windows, 0 for Linux
130 soupdir$="workdir"  'set to directory containing warriors to test
140 testdir$="nanoBM07" 'set to directory containing test set
150 testmask$="*.RED"   'set to match test warriors
160 report$="rep_bm07.txt" 'set to name of file to write bench report to
170 rounds=142 'number of rounds
180 sim$="pmars -bks 80 -p 80 -c 800 -l 5 -d 5 -P" 'sim comline
190 REM ---------------------------------------------------------------
200 sim$=sim$+" -r "+str$(rounds)+" ":print "Press Esc to stop"
210 if usewin then dc$="dir /b /on ":ps$="\" else dc$="ls -1 ":ps$="/"
220 shell dc$+soupdir$+ps$+"*.red > souplist.tmp"
230 shell dc$+testdir$+ps$+testmask$+" > testlist.tmp"
240 open report$ for output as #1:topscore=0:top$=""
250 open "souplist.tmp" for input as #2
260 while not eof(2) and inkey$<>chr$(27)
270  score=0:n=0
280  line input #2,war$:if usewin then war$=soupdir$+ps$+war$
290  open "testlist.tmp" for input as #3
300  while not eof(3)
310   line input #3,opp$:if usewin then opp$=testdir$+ps$+opp$
320   shell sim$+war$+" "+opp$+" >scores.tmp"
330   open "scores.tmp" for input as #4
340   line input #4,a$:close #4
350   z=instr(a$," "):w=val(left$(a$,z)):t=val(mid$(a$,z))
360   score=score+w*3+t:n=n+1
370  wend
380  close #3
390  score=(score/n)*(100/rounds)
400  if score>topscore then topscore=score:top$=war$
410  sc$=mid$(str$(-1*(1000+score+.00001))+"     ",3,6)
420  print sc$;"  ";war$
430  print #1,sc$;"  ";war$
435  totalscore=totalscore+score:nwars=nwars+1
440 wend
450 close #1:close #2
460 kill "souplist.tmp":kill "testlist.tmp":kill "scores.tmp"
470 print "Top score = ";str$(topscore);" by ";top$
475 print "Average score = ";str$(totalscore/nwars)
480 system
