Saturday, August 5, 2023

How to make a Polyglot ini file


How to Make a Polyglot ini File

Polyglot is an adapter that was originated by Fabien Letouzey. The Polyglot adapter allows UCI chess engines to be used in non-UCI interfaces such as the Winboard GUI. The Polyglot adapter plays the middleman between the UCI chess engine and the GUI. It passes information back and forth between the chess engine and the GUI.

The chain in its basic form looks like this:

UCI Chess Engine <---> Polyglot Adapter <---> Graphical User Interface

The Polyglot adapter itself relies on an ini file to know what commands to receive and send from the chess engine to the GUI, and from the GUI to the chess engine.

This polyglot.ini file once made needs to be put in the same folder that the Polyglot.exe file is in.

The polyglot.ini file has two sections and these two sections need to be in each polyglot.ini file that is made. The two sections are the [Polyglot] and [Engine] sections.

Each Polyglot distribution, be it Fabien Letouzey's original version or a modified version of Polyglot that someone else has released, should come with a 'read me' file. This read me file is important and it should be read thoroughly. The 'read me' file included with the Polyglot download will provide much more information about the ini file sections than is contained in this single web page.

The original Polyglot version download, and at least one modified Polyglot version that I have seen, includes example ini files that can be looked at.

O.K., I want a polyglot.ini file for a chess engine and I know what the ini file is used for, so how do I go about making the file?

In this basic example of how to make a polyglot.ini file the free version of Fabio Cavicchio's chess engine Delfi will be used. Delfi has the capability to be used as an UCI engine or a Winboard engine. We will be treating it as an UCI engine in this example.

The Delfi chess engine can be downloaded from its home page here -

To start with I open a text editor - I will use notepad. In notepad I will type in the [Polyglot] heading. All of the Polyglot section options that are used will go underneath this heading. Some of the Polyglot section options are just that "options" and some can be considered "requirements". The Polyglot read me file should tell what Polyglot section options are available for the Polyglot version you are using.

Shown below I have added some options underneath the [Polyglot] section. I have also gone ahead and added the [Engine] section heading. Though some of these Polyglot section options are not "requirements", I still put them in my basic polyglot.ini file. A lot of options that I could have added I have left out, you may decide you want them and I may even add some of them to my ini files in the future, or you may even decide that you do not want to use some of the options that I am showing here.

Once you have your basic polyglot.ini file set up you could save it, to use it as a template for future ini files you may make. That way you do not have to start from scratch each time an ini file is made.

Below is a graphic with a brief description of what each of the Polyglot section options I have include in the ini file is for. The Polyglot read me file tells more.

With the basics of an ini file in the process of being made, and with the Polyglot section options that will be used, laid out. The free Delfi engine version was downloaded and I extracted the zip file's contents to a folder named 'Delfi'.

I now go to that Delfi folder.

And I double-click the Delfi exe file. The following window opens up.

In this window type "uci" - lower case and without the quote marks. Then press the 'Enter' key.

And certain information pertaining to the chess engine will be displayed in the window, included in this information will be the UCI options that the chess engine has.

Each individual UCI chess engine will have different options. It all depends on how the chess engine author programmed the chess engine. Even different versions of the same chess engine from the same author may have different UCI options. Some UCI chess engines have way more UCI options listed than does the Delfi chess engine displayed here.

It is not required that all of the UCI options that an engine has be put into the polyglot.ini file. It really is up to you on which engine options you include in the file (at least that is my understanding of it).

The UCI options of the engine will now be copied from the window so that they can be pasted into the Engine section of the polyglot.ini file that is being made.

The explanation of the way to copy the information that follows, pertains to my operating system (Windows ME) - the way of doing it may be the same or similar for different Windows operating systems.

Left-click the MS-DOS logo in the blue title bar or right-click in the blue title bar area. Then choose 'Edit' and left-click the 'Mark' selection

Put the mouse pointer at the beginning of the very first instance of the listing that reads - "option name".

Then left-click at that starting point and while holding the left button of the mouse down, drag the pointer across until all listings that have "option name" at the beginning of them are highlighted. Then let go of the mouse button. When the mouse button is let go, everything that was highlighted should still be highlighted

Then left-clicking the MS-DOS logo or right-clicking in the blue title bar area again. This time select "Edit" and then left-click "Copy Enter". Doing this should copy the highlighted area in the window to the operating system's 'Clipboard'.

The copied information can now be pasted under the Engine heading section of the polyglot.ini file that is being made.

And here the information is shown after it has been pasted in. We will edit this information in a moment.

As already noted above on this page, some UCI engines can have a lot of UCI options, but basically what needs to be pointed out here (the above graphic) is that the UCI option tells the "name" of the option, and the default setting that the engine has for that option, and the minimum and maxium approved settings that a particular UCI option might have (all dependent on how the chess engine's author designed the particular chess engine). The chess engine's documentation really needs to be read for any options a chess engine has that you do not understand. Be it documentation included with the chess engine, or the chess engine author's website, if any. On most chess engines the majority of the options can probably be left at their default state. It all depends on what the option is, and on what you want the engine to do.

Now lets close that chess engine window that was left open. I click the close button on the window and at the dialog box I click 'Yes' and the window closes.

Below is a graphic of the being made polyglot.ini file with the chess engine options pasted into it. The graphic that is below it shows the polyglot.ini file with all of the necessary information inputted into the [Polyglot] section and with the [Engine] section information cleaned up and edited so that now the polyglot.ini file is complete for this Delfi chess engine and the file just needs to be saved.

Both graphics can be compared to see how the Engine section information was edited. What data was left in and which data was removed.

To save the polyglot.ini file, in your text editor (notepad in this case) go to 'File > Save As...'.

In the 'File name' box type in polyglot.ini and from the 'Save as type' box click 'All files'.

Then click 'Save', and save the newly made polyglot.ini file to where you want it. Remember, to use the polyglot.ini file with Polyglot, the ini file needs to be in the same folder (directory) with the polyglot.exe file.

In this example I gave the saved file the name of polyglot.ini. Other people give the ini file other names. Read the 'read me' file that comes with the Polyglot download.

The information on this page is only a guide. Some people do things differently than shown here, but the essence of how to make an ini file for use with Polyglot is (should be) correct.


The information given above is on how to manually make a polyglot.ini file.

An alternative for making polyglot.ini files is to use Alex Guerrero's excellent utility - Polyglot_GUI. Information on the utility and the download link can be found on Alex's website here.

Be sure to change Book=true to Book=false in the Polyglot section of the ini file if a Polyglot opening book is not being used.

No comments:

Post a Comment