Describe -afterGame/Tourney options in TM file
[xboard.git] / whats_new / 4.6.0 / TM.html
1 <!--#include virtual="/server/html5-header.html" -->
2 <title>XBoard - Tournament manager</title>
3 <!--#include virtual="/server/banner.html" -->
4 <!--#set var="article_name" value="/server/standards/boilerplate" -->
5 <!--#include virtual="/server/gnun/initial-translations-list.html" -->
6
7 <h2>XBoard tourney-manager function</h2>
8 <p>
9 XBoard now has a built-in tournament manager,
10 that can be used to make it play engine tournaments with more than two participants.
11 To run such a tourney, XBoard will have to create a 'tournament file'.
12 This can be done through the Match Options dialog.
13 The tournament file is a special type of settings file,
14 which contains all option settings needed to specify the tournament:
15 the list of partcipating engines, the tournament type
16 (round-robin, (multi-)gauntlet or Swiss),
17 the number of games per pairing, the number of cycles, etc.
18 This information is put in a file, rather than kept in XBoard's memory, for two reasons:
19 so that you can easily resume the tournament should it get somehow interrupted,
20 and to share it between different XBoards playing games in parallel for the same tourney.
21 </p><p>
22 For the rest a tournament behaves just like XBoard -matchMode.
23 In fact it is just a special kind of match,
24 where not all games are between the same two engines that you started with,
25 but where new players can be selected before each game,
26 and the tournament file tells XBoard how to do that.
27 </p><p>
28 All the tourney parameters that are kept in the tourney file
29 can in principle also be specified from the command line, through options, 
30 but that still would not cause XBoard to run a tourney.
31 It is really essential that XBoard has a tournament file for that,
32 because it uses the latter also for recording the progress of the tourney:
33 which games have already been played (and how they ended),
34 and which games are currently in progress.
35 With the aid of this information, XBoard will be able to resume a tourney that has been interrupted (by quitting XBoard). 
36 It only requires re-starting XBoard with the existing tournament file:
37 <pre>
38 xbooard -mm -tf MyTourney.trn
39 </pre>
40 This will make XBoard pick up where it left off.
41 XBoard is installed in such a way that the above command is automatically issued
42 whenever you double-click a tourney file.
43 </p><p>
44 This design makes it also possible to have multiple instances of XBoard work on playing the tourney games.
45 E.g. when you have a quad-core computer, and you are playing single-CPU engines in ponder-off games,
46 one core is enough to completely handle a single game, so that you can run four games simultaneously.
47 By starting multiple instances of XBoard with the same tourney file,
48 these instances will then cooperate on completing the tourney.
49 Each one will 'grab' a game from the tourney file that has not yet been played and is not in progress,
50 mark it as being in progress, and starts playing it.
51 When that game then finishes, the XBoard instance that had been playing it
52 will replace the "in-progress" mark in the tourney file by the game result,
53 and grab the next game that has not had any attention yet.
54 This continues until the entire tourney is done.
55 (Note there are options to delay starting games from a new round or cycle 
56 until the previous one has been completed.)
57 </p>
58 <p>
59 An XBoard tournament is organized as a number of cycles,
60 where each cycle is a complete repetition of the previous one.
61 The cycle is sub-divided into rounds, where each player plays a single other one.
62 A round consists of a number of pairings, where one player plays one other.
63 A pairing, finally, consists of a number of consecutively played games between the same players.
64 So you can, for instance, do a 5-cycle round-robin with 8 players and two games per pairing.
65 Players will then play two consecutive games against each other (with reversed colors)
66 before the next pairing, with two other players, will start.
67 After 4 such pairings (8 games) every player will have played two games against one opponent, 
68 and a round is completed.
69 After 7 such rounds, everyone has played everyone, which completes one tourney cycle.
70 This will then be repeated 5 times, so that in the end everyone will have played everyone else 10 times.
71 </p>
72 <h3>New command-line options</h3>
73 <p>
74 To specify the tourney, some new command-line options have been defined in XBoard.
75 Normally the user will not be exposed to these at all,
76 as they are purely designed for storing the corresponding settings in the tournament files.
77 They would not even be stored in the normal settings file (i.e. they are volatile options).
78 New options are -participants, (which holds a list of engines, one per line),
79 -tourneyType, -tourneyCycles, and -results.
80 The latter specifies which games have already been played, as a string of +-=* characters,
81 where an asterisk signifies the game is currently in progress.
82 The -tourneyType can be 0 for a round-robin, an integer N > 0 for (multi-)gauntlets,
83 (where the first N participants of the list each play all others),
84 or -1 for Swiss.
85 (The Swiss needs an external pairing engine; more about that later.)
86 </p>
87 <table cellpadding="10"><tr><td>
88 <p>
89 The previously existing option -defaultMatchGames is used to indicate the number of games per pairing,
90 so that the total number of games per pairing will be the product of the value of -defaultMatchGames and -tourneyCycles.
91 The -loadGameFile and -loadPositionFile, and the corresponding index specification
92 -loadGameIndex, -loadPositionIndex and -rewindIndex are used during the games of a pairing
93 in the same way as they would be used in a simple match between two engines,
94 and are also specified in the tourney file.
95 </p>
96 <h3>Setting up a tournament from the menu</h3>
97 <p>
98 To start a tourney you can start XBoard with or without engine,
99 and summon the Match Options dialog from the Options menu.
100 There the most important thing you should do is specify a tournament file.
101 If the file you specify already existed, (e.g. by using the browse button for it), it is all you have to specify,
102 as all other settings will then be taken from that file.
103 (This is what you would do to resume an interrupted tourney, or add a playing agent to an existing one.)
104 If the file did not exist yet, it will be created as soon as you OK the dialog,
105 but you have to complete the other parameters in the dialog first.
106 XBoard is by default configured to propose a non-existing file, by deriving a name from the date and time.
107 Unless you want the name to be more easily recognizable for later reference, you can accept that one.
108 </p><p>
109 So usually you will start picking the participants, 
110 and a combobox in the dialog allows you to pick any installed engine as often as you want.
111 The engines you select this way will be added to the displayed partcipants list.
112 Note this participants list is a normal text edit,
113 so that you can delete engines to correct mistakes,
114 shuffle the order, etc.
115 (Do not type the name of non-installed engines there, or change the names, though:
116 they will then not be recognized!)
117 After 'OK' all the settings will be written on the specified tourney file,
118 with -results last, (automatically set to an empty string,
119 to indicate none of the games has been played yet),
120 and XBoard will then switch to match mode to run the tourney.
121 </p><p>
122 Games played during the tourney will be saved as usual on the -saveGameFile,
123 depending on your option settings for this.
124 You don't have to save the PGN, if you don't want to.
125 </p>
126 </td><td>
127 <img src="Tourney.png">
128 </td></tr></table>
129
130 <table cellpadding="50"><tr><td>
131 <pre>
132 -participants {glaurung
133 Fruit 2.1
134 Fairy-Max 4.8
135 Crafty 20.14
136 }
137 -tourneyType 0
138 -tourneyCycles 1
139 -defaultMatchGames 2
140 -syncAfterRound true
141 -syncAfterCycle true
142 -saveGameFile "tm.pgn"
143 -loadGameFile ""
144 -loadGameIndex 0
145 -loadPositionFile ""
146 -loadPositionIndex 1
147 -rewindIndex 0
148 -results "=-+*"
149 </pre>
150 </td><td valign="top">
151 <p>
152 To the left you see an example of a tournament file of a (small) tourney in progress.
153 Three games have been played, the fourth is in progress,
154 as you can see in the -results string.
155 When another XBoard instance starts a match with this tournament file specified,
156 it will start playing the fifth game,
157 and the -results string in the tourney file would change to "=-+**".
158 </p>
159 <p>
160 When you would then quit the XBoard instance that is (apparently) playing game #4,
161 it would change the result string to <pre>-results "=+- *"</pre> before it exits,
162 indicating that game #4 is no longer in progress, but not yet played either.
163 The XBoard instance that is still running
164 (or a new one you start on this tournament file)
165 will then grab it the next time.
166 </p>
167 </td></tr></table>
168 <p>
169 Note that XBoard has no windows (yet?) to show you the standings or the cross table of the tournament.
170 The idea is that there exist already plenty programs to generate those from the PGN file.
171 When you let all XBoard instances save the games they play to the same file,
172 (this XBoard version uses file locking to make sure this can't cause problems!),
173 you can use your favorite PGN-to-cross-table utility on it any time you want.
174 </p>
175
176 <h3>Issuing external commands during or after a tourney</h3>
177 <p>
178 XBoard supports two new command-line options, -afterGame and -afterTourney, 
179 which can specify a text string to be executed as a system command.
180 The -afterGame command is executed after every game of the tournament,
181 and could for instance be used to automatically run a cross-table generator on the PGN save file.
182 The -afterTourney command is called after the last game of the tourney is completed,
183 and could for instance be used to automatically shut down the computer.
184 </p>
185
186 <h3>Synchronization in concurrent play</h3>
187 <p>
188 When you use multiple instances of XBoard to concurrently work on playing a tourney,
189 the option -syncAfterRound can be used to prevent XBoard from starting games from a new round,
190 when there are still unfinished games of a previous round.
191 XBoard will then wait until all these games are finished,
192 and automatically resume after that with the game of the next round it already picked.
193 This way you can guarantee that the rounds appear well-ordered in the PGN file.
194 There is a similar option -syncAfterCycle.
195 But as a cycle end coincides with the end of a round, this option is only meaningful when -syncAfterRound is false.
196 There are checkboxes near the top of the Match Options dialog where you can select if you want such synchronization,
197 but when you do not plan to use concurrency in playing the tourney, you can of course completely ignore them.
198 </p>
199
200 <h3>Substituting participants during a tourney</h3>
201 <p>
202 You can substitute one participant for another in a tourney that is already in progress.
203 (What you cannot do, however, is change the number of participants,
204 as this would mess up the entire tournament schedule.)
205 The Match Options dialog provides two buttons for that: Upgrade and Replace.
206 The way it works is this:
207 when you open the dialog while the tournament is playing,
208 (in an XBoard that is actually playing it),
209 you will see the list of participants and other tourney parameters of the current tourney already in their respective fields of the dialog.
210 All you have to do is to replace one (and not more!) of the participant names by another,
211 by editing the participants field.
212 After that, you press one of the two buttons, and that is it!
213 Upgrade will cause XBoard to use the new participant in stead of the old one in all future games,
214 while Replace would also erase all game results of the participant you replaced,
215 so that these games will be replayed.
216 This can be done while the tourney is running, there is no need to pause it in any way.
217 The only restriction currently is that you cannot use Replace on an engine that is currently playing
218 because XBoard would not know how to erase the result of the game in progress,
219 as it is not in yet, and another XBoard instance might be playing it.
220 </p><p>
221 Replacing one participant name by that of a new engine could be a bit tricky,
222 as you would have to use the exact nickname under which the engine is installed.
223 (XBoard performs lots of checks to see if there is a mistake there,
224 but it is better not to run into error popups all the time,
225 and having to do it again.)
226 The recommended way for doing this is just select the substitute from the combobox,
227 so that it will be added to the bottom of the list.
228 You can then simply use drag and drop editing to move that bottom line
229 to below the name of the engine you want to replace
230 (because the order of the engines in the list must be preserved!),
231 and then delete the line with the nickname of the participant to be replaced.
232 </p>
233
234 <h3>Running the same tourney as before</h3>
235 <p>
236 Sometimes you want to run a tourney with the same or nearly the same participants over and over again.
237 This occurs, for instance, when you are testing an engine under development, by playing it against a fixed set of opponents.
238 It would be a pain to have to pick all these oponents from the list
239 every time you want to repeat this gauntlet with a new version of the engine you want to test.
240 (The participants list could be very long!)
241 </p>
242 <p>
243 To solve this, a 'Clone Tourney' button is provided in the Match Options dialog.
244 All you have to do is select an existing tournament file (usually through the browse button),
245 which can be of a completed tourney.
246 But in stead of pressing OK after you have done that (which would attempt to resume that tourney),
247 you now press 'Clone Tourney'.
248 This copies all the parameters of the indicated tourneyfile (except the -results),
249 so they appear in their dialog fields.
250 At the same time it switches the name in the tourney-file field back to the one that was
251 originally proposed when you opened the dialog.
252 So that when you would press OK now, you would start a new tourney,
253 with exactly the same parameters as the cloned one.
254 </p>
255 <p>
256 Usually you would want to change some of the paramters first, however.
257 Like replacing the name of the gauntlet engine in the 'participants' field by that of the newer version.
258 Basically you can change anything you like, without restriction,
259 as you are really setting up a completely new and independent tourney.
260 The cloning was just a convenient way to quickly get some default settings for all of the parameters loaded into the dialog.
261 </p>
262
263 <h3>Editing tourney files</h3>
264
265 <p>
266 Although this is not recommended for a novice user, (and should also not be needed in normal use),
267 an experienced user that understands very well how things work might see some benefits in editing the tourney file.
268 Remember that the tourney file is read by every XBoard instance playing on that tourney, before every game.
269 So the tourney file is an ideal place to 'broadcast' a setting to all XBoards playing for that tourney, and none other.
270 If you thus want to have some special setting of XBoard just for that tournament,
271 which is not stored in the tourney file by default,
272 you could simply add it there.
273 </p><p>
274 You would then automatically force this setting on all XBoards playing for the tourney,
275 even those you will start up only tomorrow,
276 even if in the mean time you have changed the settings XBoard uses at startup by doing something else with it in the mean time.
277 For instance, you could write a '-variant fischerandom' option in the tourney file, 
278 if not all engines are installed to automatically play Chess960.
279 Or specify that the engine-output window should be closed, or Shogi pixmaps should be used for the pieces, or whatever.
280 The only thing you have to keep in mind is that the -results option should always remain the last one in the file.
281 So NEVER, NEVER append anything to the end of a tourney file!
282 It would also be good practice to always keep the -participants option the first one in the file.
283 (As this is used by the OS to determine mime-type of the file.)
284 </p>
285
286 </div><!-- for id="content", starts in the include above -->
287 <!--#include virtual="/server/footer.html" -->
288 <div id="footer">
289
290 <p>Please send general FSF &amp; GNU inquiries to
291 <a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
292 There are also <a href="/contact/">other ways to contact</a>
293 the FSF.<br />
294 Please send broken links and other corrections or suggestions to
295 <a href="mailto:bug-xboard@gnu.org">&lt;bug-xboard@gnu.org&gt;</a>.</p>
296
297 <p>Please see the <a
298 href="/server/standards/README.translations.html">Translations
299 README</a> for information on coordinating and submitting translations
300 of this article.</p>
301
302 <p>Copyright &copy; 2009, 2010, 2011, 2012 Free Software Foundation, Inc.</p>
303
304 <p>This page is licensed under a <a rel="license"
305 href="http://creativecommons.org/licenses/by-nd/3.0/us/">Creative
306 Commons Attribution-NoDerivs 3.0 United States License</a>.</p>
307
308 <p>Updated:
309 <!-- timestamp start -->
310 $Date: 2012/03/24 18:02:47 $
311 <!-- timestamp end -->
312 </p>
313 </div>
314 </div>
315 </body>
316 </html>