Calling bayeselo with parameters

Discussions about Winboard/Xboard. News about engines or programs to use with these GUIs (e.g. tournament managers or adapters) belong in this sub forum.

Moderator: Andres Valverde

Calling bayeselo with parameters

Postby Volker Pittlik » 05 Oct 2008, 08:50

Most often I use bayeselo to calculate a rating list from a pgn file. If I do it often its a bit annoying to type:

bayeselo
readpgn whatever.pgn
elo
mm
exactdist
ratings


all the time.

It would be comfortable abd faster to write all these commands and parameters in just one line. According to the program help the syntax is

_command_ _parameters_ [< _input_] [>[>] _output_] [;_comment_]


If I use an input file and type: "bayeselo < _file_with_the_commands_" it works fine. The inputfile is read and the commands are executed. But when I try "bayeselo readpgn _whatever_" only bayeselo starts and nothing else happens.

Obviously the second solution is more flexible. Is this just a syntax problem on my side? Does it work in the second way for someone? Can you give an example please?

Volker
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland

Re: Calling bayeselo with parameters

Postby Volker Pittlik » 05 Oct 2008, 10:05

This little script is a way around. It works for Linux only. Something similar could be written for windows too - I guess.

Code: Select all
#! /bin/bash

# calls bayeselo with an input file

if test $# -ne 1; then
   echo "This script requires one pgn file as parameter"
   exit 1
else
   params=/tmp/beparams
   echo "readpgn" $1 >$params
   echo "elo" >>$params
   echo "mm" >>$params
   echo "exactdist" >>$params
   echo "ratings >$1.ratings" >>$params
   echo "los >$1.los" >>$params
   echo "details >$1.details" >>$params
   echo "x" >>$params
   echo "x" >>$params
   bayeselo <$params >/dev/null 2>/dev/null # beyeselo's output is irrelevant here
   cat $1.ratings
fi


los and details can be displayed by cat _input.pgn.los_ ...details.

Volker
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland

Re: Calling bayeselo with parameters

Postby Patrick Buchmann » 05 Oct 2008, 10:40

Hi Volker,

You can add the parameters in a texte file.

I use this:

Command line : bayeselo.exe <bayeselo.txt

Content of the bayeselo.txt:
readpgn file.pgn
elo
mm
offset 2200
exactdist
ratings >rating.txt
x
x


The two x close the program.
The rating is written in a file named rating.txt.

Regards,
Patrick
Patrick Buchmann
 
Posts: 59
Joined: 26 Sep 2004, 19:47
Location: Elsass

Re: Calling bayeselo with parameters

Postby Volker Pittlik » 05 Oct 2008, 10:56

Patrick Buchmann wrote:Hi Volker,

You can add the parameters in a texte file.

...


Yes. My little script does exactly the same. (nice to see there is something doing the same in windows).

I'm writing a set of shell scripts making it easier to run tournaments in Linux. I can now use the idea in there (however it would be interesting to know if somehow using a parameter from the command line work...).


Volker
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland

Re: Calling bayeselo with parameters

Postby Zach Wegner » 05 Oct 2008, 18:21

Here's the way I do it, using immediate redirection:
Code: Select all
${BAYESELO} > /dev/null <<EOF
readpgn ${GAMEFILE}
elo
    prior 0.1
    mm
    exactdist
    offset 2000 umax
    ratings >${RATINGFILE}
    x
x
EOF

This also redirects output to /dev/null, so it's completely silent. You may also want to look at my source repository (http://zct.cvs.sourceforge.net/viewvc/zct/Scripts/), where I have put up a small collection of scripts to run tournaments. It's specifically tailored to ZCT, but it's built in a way that allows for easy modification.
User avatar
Zach Wegner
 
Posts: 182
Joined: 26 Sep 2004, 22:02
Location: Austin, Texas, USA

Re: Calling bayeselo with parameters

Postby Volker Pittlik » 05 Oct 2008, 21:52

Zach Wegner wrote:Here's the way I do it, using immediate redirection:... You may also want to look at my source repository.......


Interesting. I see your code is more compact than mine. OTOH mine is easier to read (for me). I'll test my scripts for some more time, then I'll publish it somewhere.


Volker
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland


Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 31 guests