Bayeselo is a command line program, so I run it from a "Command Prompt" window. It reads commands from standard input, which is the keyboard unless you redirect it. After it reads and executes a command, it continues to read more commands until you give it a command to exit. It has a hierarchy of command levels, what Remi calls interfaces.
When you first run it you are in the ResultSet interface. The commands in this set are all related to inputting match results. You can ask for a brief summary of the commands at any interface by type a question mark (?). If you do that at the ResultSet inferface you get this output:
Code: Select all
ResultSet commands
~~~~~~~~~~~~~~~~~~
players ......... list players
names ........... alphabetical list of player names
results ......... list game results
pgn ............. write results in PGN format
reset ........... reset results and players
addplayer <pn> .. add one player with name <pn>
addresult w b r . add result (w = white, b = black, r = result)
r = 0 (b wins), 1 (draw), or 2 (w wins)
removeresult n .. remove result number
removeplayer n .. remove games of player n
removerare n .... remove games of players with less than n games
pack ............ pack players (remove players with 0 games)
readpgn <file>... read PGN file
connect [p] [fr] remove players not connected to p [fr=forbidden result]
elo ............. open Elo-estimation interface
A number of commands allow you to specify a player or list of players as parameters. For these commands, you do not input the player names, you refer to them by a number. Player numbers begin with 0 and seem to be assigned in the order that they are first encountered by Bayeselo. You can get a list of the players names and their reference numbers using the "players" command.
There are also commands to add players and results directly, without reading them from a pgn file. However these commands would be tedious to use for inputting many games as you can only enter one result at a time. The command that I added is the ability to input the number of wins, losses, and draws of an entire match between two players. The help line that I added for this new command is:
Code: Select all
addwld a b nw nl nd .. add WLD results between players a and b (from the point of view of a)
Code: Select all
addplayer test
addplayer baseline
addwld 0 1 25 10 123
Code: Select all
elo
advantage 0
mm
exactdist
Code: Select all
Rank Name Elo + - games score oppo. draws
1 test 12 20 20 158 55% -12 78%
2 baseline -12 20 20 158 45% 12 78%
The "los" command takes 3 parameters -- the lowest player number, the number of players, and the number of digits to use in displaying superiority. Typing the command
Code: Select all
los 0 2 4
Code: Select all
tes bas
test 879
baseline 120
Since Bayeselo reads from standard input, you can put the commands in a text file instead of typing them interactively, and redirect standard input when you run the program. To automate the commands in this example, you would create a text file with
Code: Select all
addplayer test
addplayer baseline
addwld 0 1 25 10 123
elo
advantage 0
mm
exactdist
ratings
los 0 2 4
x
x
Code: Select all
bayeselo <EloCmds.txt
- Download the bayeselo source from Remi Coulom's web site here: http://remi.coulom.free.fr/Bayesian-Elo/ and unzip it to a convenient directory.
- Create a new project for Bayeselo of type "console application". Add only one file to the project, bayeselo.cpp. This file includes all the other source files.
- There is a statistical function named erfc() used by bayeselo that is missing from the Microsoft libraries. I did some searching and found an open source math library package that had this function called "cephes". There are a number of packages in the cephes library. The one that has erfc is called "double". I downloaded it from here: http://netlib.org/cephes/doubldoc.html.
- Add the follwing files from the cephes library to the directory where the bayeselo project is located: mconf.h const.c exp2.c expx2.c isnan.c mtherr.c ndtr.c polevl.c. Add these files to the Visual Studio project.
- Edit mconf.h and comment out the lines that define the macros INFINITIES and NANS.
- Add the preprocessor definition _CRT_SECURE_NO_WARNINGS to the bayeselo project settings, or you will get a ton of warnings. You will still get some warnings when you compile, but this eliminates a large number of them.
- In the source file CResultSetCUI.cpp, find the declaration of the array
Code: Select all
const char * const CResultSetCUI::tszCommands[] =
Code: Select all
"addwld",
Code: Select all
IDC_AddWLD,
Code: Select all
out << "addwld a b nw nl nd .. add WLD results between players a and b (from the point of view of a)\n";
- In the same function as above, and in the same switch statement, add these lines:
Code: Select all
case IDC_AddWLD:
{
int i;
unsigned White = 0;
unsigned Black = 0;
unsigned nwins = 0;
unsigned nlosses = 0;
unsigned ndraws = 0;
std::istringstream(pszParameters) >> White >> Black >> nwins >> nlosses >> ndraws;
if (White < vecName.size() && Black < vecName.size()) {
for (i = 0; i < nwins; ++i)
rs.Append(White, Black, 2); /* white wins. */
for (i = 0; i < nlosses; ++i)
rs.Append(White, Black, 0); /* black wins. */
for (i = 0; i < ndraws; ++i)
rs.Append(White, Black, 1); /* draws. */
}
else
out << "Error: no such player\n";
}
break;
Code: Select all
extern "C" double erfc(double a);
-- Ed