Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Linux and Test Games - any automated interfaces?

Author: Andrew Williams

Date: 13:58:46 01/19/04

Go up one level in this thread


On January 19, 2004 at 14:50:38, Frank Phillips wrote:

>On January 19, 2004 at 13:52:33, Andrew Williams wrote:
>
>>On January 19, 2004 at 11:46:25, Anthony Cozzie wrote:
>>
>>>I would like to run some matches on my machine at home; does anyone know of an
>>>interface that is capable of running a multigame match?
>>>
>>>AFAIK, XBoard only runs 1 game at a time.  We need Arena for Linux, Frank!!
>>>
>>>anthony
>>
>>xboard can do this. Here is a script that I use a lot:
>>
>>#!/usr/bin/tcsh
>># Run multiple games based on standard opening positions
>>cp match.pgn match.bak
>>rm match.pgn
>>
>>set player1 = "./PMv1007 xboard"
>>set player2 = "./futil80 xboard"
>>set tc  = 3
>>set inc = 1
>>set testset = "../epd/openings.epd"
>>
>>set position = 0
>>
>>while ($position < 50)
>>
>>
>>	@ position++
>>	echo Running Position $position
>>	xboard -mg 2 -tc $tc -inc $inc  -lpf $testset -lpi $position \
>>            -sgf match.pgn -autoflag -fcp "$player1" -scp "$player2" \
>>            -animateMoving False -showCoords True -size Small \
>>	    -ponderNextMove False -popupExitMessage False
>>
>>end
>># this is the end of my shell script
>>
>>openings.epd is an epd file with 120-ish opening positions in.
>>
>>
>>Andrew
>
>
>Thanks for posting this.  I did not know about the -lpf and -lpi xboard
>commands.  Looks useful.
>
>I should RTFM more thoroughly, I suppose :-)
>
>Frank

I've built up quite a few of these little scripts over the years. I use this awk
program to give me the result of a match produced by scripts like the one above:

# start of the awk program
BEGIN           {       printf("\n\n")          }

/^[[]White/ {   match($2, "[A-Za-z][-A-Za-z0-9_]*");
                whiteIs = substr($2, RSTART, RLENGTH)
                score[whiteIs] += 0
}

/^[[]Black/ {   match($2, "[A-Za-z][-A-Za-z0-9_]*");
                blackIs = substr($2, RSTART, RLENGTH)
                score[blackIs] += 0
}

/Result/        {   if(match($2, "1-0")) {
                        score[whiteIs]++;
                        printf("%16s 1-0 %-16s\n", whiteIs, blackIs);
                    } else if(match($2, "0-1")) {
                        score[blackIs]++;
                        printf("%16s 0-1 %-16s\n", whiteIs, blackIs);
                    } else if(match($2, "1/2")) {
                        score[whiteIs] = score[whiteIs] + 0.5
                        score[blackIs] = score[blackIs] + 0.5
                        printf("%16s 1/2 %-16s\n", whiteIs, blackIs);
                    }
                }

END {
   printf("\n\n\n       MATCH SCORE\n       ===========\n", "FINAL SCORE")
   for(side in score) {
      printf("\n%12s %0.1f", side, score[side]);
   }
   printf("\n\n");
}

### end of the awk program


You can run this in linux like this:

gawk -f scorepgn.awk match.pgn



Andrew



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.