In my .xboardrc I have configurations of various engines, e.g.,
"komodo (no book)" -fcp komodo-bmi2 -fUCI
"stockfish" -fcp sf15 -fUCI -usePolyglotBook true -fNoOwnBookUCI -polyglotBook /path/to/Elo2400.bin
How can I pass additional UCI parameters related to nodes per second, depth of search, and so on? I have slight confusion about what is handled by xboard and what is handled by stockfish. For example, after I select Engine --> Load New 1st Engine, I check Engine #1 Settings, and it shows skill levels 1-20, polyglot book file book.bin (with option to browse), and so on. I don't have book.bin file, so I don't know where this is coming from, and also from my experiment it seems that it is not ignoring the polyglotBook option I have passed above. How are the skill levels 1-20 set? What are the stockfish engine options for setting these levels, and where can I set them permanently so that xboard will know them? Can I create configurations in .xboardrc for skill levels?
How to pass UCI parameters to Xboard?
Moderator: Ras
-
chesskobra
- Posts: 359
- Joined: Thu Jul 21, 2022 12:30 am
- Full name: Chesskobra
-
hgm
- Posts: 28464
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: How to pass UCI parameters to Xboard?
It is indeed a bit confusing. Because XBoard runs UCI engines through a protocol adapter (Polyglot), but Polyglot does a lot more than just translating the protocol commands. So there are three agents involved. And sometimes each of those can handle an opening book.
XBoard can use a 'GUI book', meaning that it consults the book itself on behalf of an engine that has to move, without the engine having any say in it. It will just get the chosen book move 'force fed'. This is controlled by a number of XBoard options: usePolyglotBook, polyglotBook and -f/sNoOwnBookUCI. 'Polyglot' in these option names refer to the format of the book, not to the actual use of Polyglot. The first two options are persistent options, and their setting would apply to all engines. It thus doesn't make much sense to include them with a specific engine in the engine list, as they would apply to the opponent as well. And to all engines used later that did not explicitly specify a polyglotBook. (And if two engines that play each other would specify a different GUI book, the second engine would prevail, as its options are parsed last.) These are options you typically set once and for all, through the Common Engine Settings menu dialog rather than by editing the settings file.
The ...NoOwnBookUCI options are engine-specific, and therefore volatile. Their names are a legacy, as they apply just as well to non-UCI engines, and they can also be written as first/secondXBook. These control whether a GUI book that is enabled (valid filename and usePolyglotBook on) will be consulted on behalf of the first or second engine.
Now when you run a UCI engine through an adapter, the adapter can add its own options to that of the engine when relaying the options to XBoard. Polyglot has a lot of options itself (all starting with the word Polyglot), and these would all appear in the Engine Settings dialogs. Some options are also for handling an opening book: Polyglot can also handle a book on behalf of the UCI engine for which it mediates. It would then never actually consult the engine while it still has book moves for the current position. If you play two UCI engines against each other, they can each have their own option settings, including the settings of the Polyglot options. So then they can use different books, which also differ from the GUI book. Note that there also will be an button option 'Polyglot Save', which will cause Polyglot to save the current setting of its own and the engine's options on a file specific for that engine (in the user's .polyglot directory), so that the next time the engine is used they would still apply.
Finally some engines (e.g. Fruit) support an opening book by themselves, and would also have options to select that.
XBoard supports an option first/secondOptions, which can be set to a string that is a comma-separated list of name=value pairs. This option can be used in the engine list to control setting of the engine-defined options. E.g. you could install an engine with a non-standard strength setting with an engine line
"stockfish" -fcp sf15 -fUCI -firstOptions "UCI_LimitStrength=1,UCI_Elo=1500"
The latest XBoard version would have a button 'Make Persistent' in the Engine Settings dialogs that would automatically append such an option (or modify an existing one) to the engine's line in the engine list for all options that have a setting different from the engine's default. I suppose that answers your question in the title.
Note that all this can be done without editing the .xboardrc file; even editing the engine list (for which there is a menu item) should only be rarely necessary, as the Load Engine dialogs that can be used to register the engine already has checkboxes for the more common XBoard options you might want to add (such as -fUCI or -firstXBook). Editing the engine list is mostly useful for sorting the lines in a different order, or to organize them in groups when the list gets uncomfortably long.
XBoard can use a 'GUI book', meaning that it consults the book itself on behalf of an engine that has to move, without the engine having any say in it. It will just get the chosen book move 'force fed'. This is controlled by a number of XBoard options: usePolyglotBook, polyglotBook and -f/sNoOwnBookUCI. 'Polyglot' in these option names refer to the format of the book, not to the actual use of Polyglot. The first two options are persistent options, and their setting would apply to all engines. It thus doesn't make much sense to include them with a specific engine in the engine list, as they would apply to the opponent as well. And to all engines used later that did not explicitly specify a polyglotBook. (And if two engines that play each other would specify a different GUI book, the second engine would prevail, as its options are parsed last.) These are options you typically set once and for all, through the Common Engine Settings menu dialog rather than by editing the settings file.
The ...NoOwnBookUCI options are engine-specific, and therefore volatile. Their names are a legacy, as they apply just as well to non-UCI engines, and they can also be written as first/secondXBook. These control whether a GUI book that is enabled (valid filename and usePolyglotBook on) will be consulted on behalf of the first or second engine.
Now when you run a UCI engine through an adapter, the adapter can add its own options to that of the engine when relaying the options to XBoard. Polyglot has a lot of options itself (all starting with the word Polyglot), and these would all appear in the Engine Settings dialogs. Some options are also for handling an opening book: Polyglot can also handle a book on behalf of the UCI engine for which it mediates. It would then never actually consult the engine while it still has book moves for the current position. If you play two UCI engines against each other, they can each have their own option settings, including the settings of the Polyglot options. So then they can use different books, which also differ from the GUI book. Note that there also will be an button option 'Polyglot Save', which will cause Polyglot to save the current setting of its own and the engine's options on a file specific for that engine (in the user's .polyglot directory), so that the next time the engine is used they would still apply.
Finally some engines (e.g. Fruit) support an opening book by themselves, and would also have options to select that.
XBoard supports an option first/secondOptions, which can be set to a string that is a comma-separated list of name=value pairs. This option can be used in the engine list to control setting of the engine-defined options. E.g. you could install an engine with a non-standard strength setting with an engine line
"stockfish" -fcp sf15 -fUCI -firstOptions "UCI_LimitStrength=1,UCI_Elo=1500"
The latest XBoard version would have a button 'Make Persistent' in the Engine Settings dialogs that would automatically append such an option (or modify an existing one) to the engine's line in the engine list for all options that have a setting different from the engine's default. I suppose that answers your question in the title.
Note that all this can be done without editing the .xboardrc file; even editing the engine list (for which there is a menu item) should only be rarely necessary, as the Load Engine dialogs that can be used to register the engine already has checkboxes for the more common XBoard options you might want to add (such as -fUCI or -firstXBook). Editing the engine list is mostly useful for sorting the lines in a different order, or to organize them in groups when the list gets uncomfortably long.
-
chesskobra
- Posts: 359
- Joined: Thu Jul 21, 2022 12:30 am
- Full name: Chesskobra
Re: How to pass UCI parameters to Xboard?
This is an excellent answer, thank you. I have a couple of questions below.
-usePolyglotBook true
-polyglotBook "/path/to/komodo.bin"
So I am not sure if in the game stockfish actually used Elo2400.bin or komodo.bin. I can probably test it by creating a bin book of 4 plies for stockfish and a bin book of 12 plies for komodo, and check that SF starts to think from the 5th ply while komodo plays instantly for longer.
Second I experimented with stockfish (with book) as first engine against stockfish (without book) as second engine, and I think it behaves as I expect, that is the stockfish without book is taking time to think right from the first move, but stockfish with book is making moves instantly.
Finally, where can I find a list of options that can be passed using first/secondOptions (e.g., UCI_LimitStrength=1,UCI_Elo=1500 in your example)? I noticed that they are in UCI engine interface specification. How would limiting strength or Elo work in an engine independent way? Also, what do first/second mean in many xboard options?
I didn't understand this. I did the following experiments. First I played stockfish as first engine, using book Elo2400.bin, against komodo as second engine, using book komodo.bin, and both used opening books. Later I noticed that in .xboardrc file that the following lines are saved:hgm wrote: ↑Fri Jul 22, 2022 8:49 am ... the actual use of Polyglot. The first two options are persistent options, and their setting would apply to all engines. It thus doesn't make much sense to include them with a specific engine in the engine list, as they would apply to the opponent as well. And to all engines used later that did not explicitly specify a polyglotBook. (And if two engines that play each other would specify a different GUI book, the second engine would prevail, as its options are parsed last.)
-usePolyglotBook true
-polyglotBook "/path/to/komodo.bin"
So I am not sure if in the game stockfish actually used Elo2400.bin or komodo.bin. I can probably test it by creating a bin book of 4 plies for stockfish and a bin book of 12 plies for komodo, and check that SF starts to think from the 5th ply while komodo plays instantly for longer.
Second I experimented with stockfish (with book) as first engine against stockfish (without book) as second engine, and I think it behaves as I expect, that is the stockfish without book is taking time to think right from the first move, but stockfish with book is making moves instantly.
Finally, where can I find a list of options that can be passed using first/secondOptions (e.g., UCI_LimitStrength=1,UCI_Elo=1500 in your example)? I noticed that they are in UCI engine interface specification. How would limiting strength or Elo work in an engine independent way? Also, what do first/second mean in many xboard options?
-
hgm
- Posts: 28464
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: How to pass UCI parameters to Xboard?
You can be sure the two engines used the same book (komodo.bin), because XBoard only suports a single book at the time. (Specified by the latest -polyglotBook option it encountered. Which could be in the settings file, on the command line, or when loading a new engine.) This book feature is only intended for providing diversity in tournaments and matches.
Whether the book is used can be controled on a per-engine basis through the -first/secondXBook options. So it is possible to play one engine with book, and the other without. When you let Polyglot handle the book you can specify a different book for each UCI engine, through the Polyglot options in the Engine Settings dialog. Polyglot can make such settings persistent per engine name, irrespective of whether the engine is used as first or second. Like any options of the engine they can also be controlled through XBoard's options -first/secondOptions "Polyglot BookFile=...".
XBoard's first/second options (or f/s) are acting only for the first or second engine. E.g. to specify whether this is UCI or CECP ('WB'). These are never persistent, and loading a new engine resets them to their defaults first. These options are described on the xboard man page, section command-line options, sub-section engine options. Note that nowadays we configure XBoard to only use a singleEnginelist, and when an engine from that is chosen to run as second engine, all occurences of -first or -s are automatically replaced by -second or -s.
Engine options are described in the engine documentation. (And their names can be seen in the Engine Settings dialog when the engine is loaded. Anything there can be ste through a -first/secondOption option.) For UCI engines there are some standard options, which for all UCI engines must use the same name, if the feature they control is supported at all. Often these refer to essential features that almost any engine needs (Hash, Ponder, UCI_Analyze), and then they are often directly controlled by the GUI or adapter, and will not be shown in the Engine Settings dialogs. What is in that dialog is intrinsically engine-dependent. XBoard has no idea what these options do; it just relays the options and their settings between user and engine. There is no centralized feature in XBoard to set Elo for all engines simultaneously (such as there is for hash-table size).
Whether the book is used can be controled on a per-engine basis through the -first/secondXBook options. So it is possible to play one engine with book, and the other without. When you let Polyglot handle the book you can specify a different book for each UCI engine, through the Polyglot options in the Engine Settings dialog. Polyglot can make such settings persistent per engine name, irrespective of whether the engine is used as first or second. Like any options of the engine they can also be controlled through XBoard's options -first/secondOptions "Polyglot BookFile=...".
XBoard's first/second options (or f/s) are acting only for the first or second engine. E.g. to specify whether this is UCI or CECP ('WB'). These are never persistent, and loading a new engine resets them to their defaults first. These options are described on the xboard man page, section command-line options, sub-section engine options. Note that nowadays we configure XBoard to only use a singleEnginelist, and when an engine from that is chosen to run as second engine, all occurences of -first or -s are automatically replaced by -second or -s.
Engine options are described in the engine documentation. (And their names can be seen in the Engine Settings dialog when the engine is loaded. Anything there can be ste through a -first/secondOption option.) For UCI engines there are some standard options, which for all UCI engines must use the same name, if the feature they control is supported at all. Often these refer to essential features that almost any engine needs (Hash, Ponder, UCI_Analyze), and then they are often directly controlled by the GUI or adapter, and will not be shown in the Engine Settings dialogs. What is in that dialog is intrinsically engine-dependent. XBoard has no idea what these options do; it just relays the options and their settings between user and engine. There is no centralized feature in XBoard to set Elo for all engines simultaneously (such as there is for hash-table size).