XBoard concurrent TourneyManager mode

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

XBoard concurrent TourneyManager mode

Post by hgm »

I have extended XBoard match mode to conduct more general tourneys, such as round-robins and gauntlets, which require changing of the engines during the tourney. So this enhancement became only possible after I implemented such engine changing during the session, through the Load Engine dialog:

Image

This dialog allows you to create a list of installed engines in the XBoard settings file, similar to the one WinBoard has (the -firstChessProgramNames). Of course you can edit the settings file in the case of XBoard as well. Once you have such a list of installed engines, you can pull engines from it to set up a tourney, in the Match Options dialog:

Image

When you specify a tourney file, XBoard will store the parameters from this dialog there, and switch to match mode. In the presence of the tourney file, XBoard will use the info in that file during a 'match' to decide about pairings. (Without a tourney file it would just play an old-fashioned match with the two currently loaded engines.)

What makes it nice is that the tourney file also contains the info on the game results, and which games are in progress. So when a tourney is interrupted, (by quitting XBoard), you can later start a new XBoard using the same tournament file to resume it, with the command

xboard -mm -tf MyTourney.trn

(assuming the tournament file was called MyTourney.trn). You could also do that interactively, by giving the name of the existing tournament file in the Match Options dialog.

That same command could also be used to start a second XBoard on the same tourney while the XBoard that originally was working on it is still running. They will then distribute the not-yet-played games between them. So you could use as many concurrent instances of XBoard working on a tourney as the number of CPUs in your computer allows. (And more, if you play the engines remote! :idea: )

For a more elaborate description, see http://hgm.nubati.net/TM.html .

The sources of this alpha version are at http://hgm.nubati.net/cgi-bin/gitweb.cg ... ds/tourney . No doubt there will still be many bugs, but the basic thing seems to work.

You are invited to try it!
And I am open to suggestions for improving it.
User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard concurrent TourneyManager mode

Post by hgm »

This works like a charm now!

I have tested it using two 'playing agents' to run a 4-player round-robin. If requested so (which is default setting) it nicely waits for the rounds to complete, before starting a new one. It is resistant to quitting during games as well as during such a wait: when that happens it 'un-reserves' the reserved game before exiting, and another XBoard instance, still running or started later, will pick that game again.

It is also possible to take out an XBoard without losing a game: I made it such that the Machine Match menu item stays sensitive (and check-marked) during a match, but when you click it in that case it schedules termination of the match after the current game (and unchecks the item). This can also be used in normal (two-player) matches.

PGN round tags in the save file appear as if all the games in a pairing are individual rounds, so that each player has exactly one round "1" tag, one round "2" tag, etc.

Not sure what I should print in the title bar in stead of the usual (W-D-L) score, though. I guess I could use the WDL of the engines currently playing there, but that might not be terribly useful. Perhaps I should simply print the round, so you can see you are in a tourney.
Roger Brown
Posts: 782
Joined: Wed Mar 08, 2006 9:22 pm

Re: XBoard concurrent TourneyManager mode

Post by Roger Brown »

hgm wrote:This works like a charm now!

I have tested it using two 'playing agents' to run a 4-player round-robin. If requested so (which is default setting) it nicely waits for the rounds to complete, before starting a new one. It is resistant to quitting during games as well as during such a wait: when that happens it 'un-reserves' the reserved game before exiting, and another XBoard instance, still running or started later, will pick that game again.

It is also possible to take out an XBoard without losing a game: I made it such that the Machine Match menu item stays sensitive (and check-marked) during a match, but when you click it in that case it schedules termination of the match after the current game (and unchecks the item). This can also be used in normal (two-player) matches.

PGN round tags in the save file appear as if all the games in a pairing are individual rounds, so that each player has exactly one round "1" tag, one round "2" tag, etc.

Not sure what I should print in the title bar in stead of the usual (W-D-L) score, though. I guess I could use the WDL of the engines currently playing there, but that might not be terribly useful. Perhaps I should simply print the round, so you can see you are in a tourney.



Hello H.G.,

While I am thrilled to bits for my Xboard using brethren, I must admit that I am a selfish Winboard user. I know that Winboard can play tournaments using any of at least half a dozen tools out there but to have the tournament feature in-built would be even friendlier to users - no third party software.

I will admit that Pradu's WBTM is easy to use and has powerful features but to use one installation file for everything is approaching my ideal.

I am offering to test these features if required.....

:-)

Later.
User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard concurrent TourneyManager mode

Post by hgm »

Well, actually the tournament feature does work under WinBoard as well as under XBoard. Except that there are no dialogs for it yet. So you would have to create the tournament file by hand.

But don't despair: I am working on it. Unfortunately the XBoard sources referred to above did not compile for WinBoard at all. (The back-end calling routines that were only in the XBoard front-end.) So I had to start shuffling some code around (probably breaking XBoard again). But at least it compiles now, even if it still crashes with an error message.

What I had in mind was a 'quick and dirty' hack of the startup dialog:
I have added a memo to see the the list of participants there, and an 'Add' button that can be used to add the engine selected by the second engine combobox to that list.

To run a tourney with those participants, you would have to also specify a tournament file, but you can do that through the 'Additional options', by typing '-tf FILENAME' there. (I could make a separate entry field for 'tourney file', but it would only save you typing the '-tf', and that is hardly worth it.

The rest of the tourney parameters would also have to be given through 'Additional options', but often defaults will be sufficient. For the -defaultMatchGames there already is an input in the Common Engine Options dialog (and this is used for 'Games per Pairing' in tourney mode), and it is a persistent option, so it will get your personal default from the settings file. Things such as Time Control and -saveGameFile as well. Most other options are volatile, and will thus always start as their compiled-in defaults: -tourneyType is set to round-robin, -tourneyCycles to 1. Which is usually what you want. If not, you can add the alternative setting in the Additional-options field.

So the usual action would be to startup WinBoard through the Startup Dialog, pull the participants from the second-engine list, type "-mm -tf something.trn", and press 'OK'. The -mm would make sure you start in match mode, running the tournament. If you leave it out, the tournament wouldn't start automatically, but you can start it from the menu ('Machine Match'). That would give you the opportunity to tweak some other parameters first, like TC, Event Name. These will not go into the tourney file, so be sure to save settings before starting up another WinBoard instance to work on the same tourney, when you altered them compared to what already was in the settings file.

(Would it be an idea to save those in the tourney file too? That would prevent mistakes, but you could no longer use the menus to tweak it afterwards. My philosophy was that things that are already in the settings file would not need to be in the tournament file.)
User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard concurrent TourneyManager mode

Post by hgm »

OK, I got something that could pass for workable WinBoard. (Stupid DOS line endings caused seeking to the wrong place, and there is no file locking as flock doesn't seem to exist in MINGW. But the chance that two games finish so nerly at the same time that this would ever be a problem is very slight.)

It can be downloaded from http://hgm.nubati.net/WinBoard-TM.zip (just a bare winboard.exe). No fancy dialogs yet, so remember the options you (might) need to specify a tourney, as 'Additional options' in the Startup Dialog:

-tf NAME (or -tourneyFile): the NAME of the tourney file you want to create or use.
-mm (or -matchMode): sets it running as soon as you OK the startup. (Otherwise only after selecting Machine Match from menu.)
-tourneyCycles N: number of cycles in the tourney (default 1).
-tourneyType N: 0 = round-robin (default), N>0 is (multi-)gauntlet.
-defaultMatchGames N: games per pairing (also in Common Engine Options dalog).
-lgf NAME (or -loadGameFile): file with opening lines.
-lgi N (or -loadGameIndex): opening line to use (-1 or -2 = step through all per 1 or 2 games).
-lpf NAME (or -loadPositionFile): file with start positions.
-lpi N (or -loadPositionIndex): start position to use (-1 or -2 = step through all per 1 or 2 games).
-sgf NAME (-saveGameFile): file where the games are saved (also in Save Options dialog).

Some things do not work yet. (Like logos...)
Michel
Posts: 2292
Joined: Mon Sep 29, 2008 1:50 am

Re: XBoard concurrent TourneyManager mode

Post by Michel »

flock doesn't seem to exist in MINGW
I think windows has global mutexes. Perhaps they could be used for this?

http://msdn.microsoft.com/en-us/library ... 85%29.aspx

EDIT: And how about this?

http://git.savannah.gnu.org/gitweb/?p=g ... ib/flock.c
User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard concurrent TourneyManager mode

Post by hgm »

I'll have a look at it.

In any case, the engine logos should work now.
Roger Brown
Posts: 782
Joined: Wed Mar 08, 2006 9:22 pm

Re: XBoard concurrent TourneyManager mode

Post by Roger Brown »

hgm wrote:OK, I got something that could pass for workable WinBoard. (Stupid DOS line endings caused seeking to the wrong place, and there is no file locking as flock doesn't seem to exist in MINGW. But the chance that two games finish so nerly at the same time that this would ever be a problem is very slight.)

It can be downloaded from http://hgm.nubati.net/WinBoard-TM.zip (just a bare winboard.exe). No fancy dialogs yet, so remember the options you (might) need to specify a tourney, as 'Additional options' in the Startup Dialog:

-tf NAME (or -tourneyFile): the NAME of the tourney file you want to create or use.
-mm (or -matchMode): sets it running as soon as you OK the startup. (Otherwise only after selecting Machine Match from menu.)
-tourneyCycles N: number of cycles in the tourney (default 1).
-tourneyType N: 0 = round-robin (default), N>0 is (multi-)gauntlet.
-defaultMatchGames N: games per pairing (also in Common Engine Options dalog).
-lgf NAME (or -loadGameFile): file with opening lines.
-lgi N (or -loadGameIndex): opening line to use (-1 or -2 = step through all per 1 or 2 games).
-lpf NAME (or -loadPositionFile): file with start positions.
-lpi N (or -loadPositionIndex): start position to use (-1 or -2 = step through all per 1 or 2 games).
-sgf NAME (-saveGameFile): file where the games are saved (also in Save Options dialog).

Some things do not work yet. (Like logos...)


Hello H.G.,

Wow, talk about service!

I am going to have a look at this as soon as I get home!

I certainly cannot complain about your willingness to listen to your user base.

Logos are the least. When I get everything up and running I will get back to that....

Later.
User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard concurrent TourneyManager mode

Post by hgm »

Image