Page 1 of 1

Calling bayeselo with parameters

PostPosted: 05 Oct 2008, 08:50
by Volker Pittlik
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

Re: Calling bayeselo with parameters

PostPosted: 05 Oct 2008, 10:05
by Volker Pittlik
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

Re: Calling bayeselo with parameters

PostPosted: 05 Oct 2008, 10:40
by Patrick Buchmann
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

Re: Calling bayeselo with parameters

PostPosted: 05 Oct 2008, 10:56
by Volker Pittlik
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

Re: Calling bayeselo with parameters

PostPosted: 05 Oct 2008, 18:21
by Zach Wegner
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.

Re: Calling bayeselo with parameters

PostPosted: 05 Oct 2008, 21:52
by Volker Pittlik
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