Saturday, August 5, 2023

A Basic Guide for setting up Winboard + UCI Chess Engine

 



Below is a basic guide for setting up Winboard to use UCI chess engines via the Polyglot adapter. Winboard_X and the free UCI chess engine Rybka 2.2n2 are being used in the example.

************************************

Go to - http://www.ascotti.org/programming/chess/winboard_x.htm - and download Winboard_X (The latest version from Jan 29, 2006). Winboard_X is the regular Tim Mann's Winboard GUI with some modifications done to it. There is a Winboard_F with chess variants for download on the Internet but I use Winboard_X and I am using that version in this example.

If you desire to use Winboard_F information on it can be found here -

http://www.open-aurec.com/wbforum/viewtopic.php?t=49439

Here in my Program Files folder I have made a folder named Winboard_X and downloaded the Winboard_X zip file to it.

I have extracted the zip file contents to the same folder. The readme file contained in the zip file has information on the modifications that were done to the GUI.

Double-click the Winboard_X executable file and select 'Just view or edit game files' and click 'OK'.

Close all of the windows that opened. What is happening here is that we are allowing Winboard_X to create its winboard.ini file (shown in the graphic below). We will come back to the Winboard GUI in a moment.

In the Winboard_X folder I have made two additional folders. One named 'Polyglot' and one named 'Chess Engines'. In my personal set up I keep the Polyglot and Chess Engines folders in different locations but for ease of explanation I am putting them in the Winboard_X folder.

Go to - http://wbec-ridderkerk.nl/html/download.htm - and on the left-hand side of the page click the 'PolyGlot (UCI2WB)' link. On the page that opens, download the original version 'PolyGlot 1.4' zip file and the 'Cygwin1.dll' rar file to a temporary place on your computer,

and extract the files contents to the temporary place.

A note: Polyglot 1.4 needs the cygwin1.dll file to work. On the Polyglot download page you will see reference to:

"New: PolyGlot 1.4w (Fabien Letouzy, modified by Fonzy Bluemers!)"

This Fonzy Bluemers modified version of Polyglot functions on its own without the need of the cygwin1.dll file. So if you want, you can use the Fonzy Bluemers modified Polyglot version instead.

In the example, we have downloaded the original version of Polyglot and the cygwin1.dll file to a temporary folder, and have extracted both of the downloaded files to the same folder.

In the Cygwin1.dll folder, that is now in the temporary folder, move the cygwin1.dll file that is in the folder to the Polyglot folder that is located in the Winboard_X folder, and in the polyglot_14 folder move the polyglot exe file, and if you want the readme text file, to the Polyglot folder, too.

Below is what is now in Polyglot folder that is in the Winboard_X folder. (The remaining contents still in the temporary folder can be deleted, if desired.)

For an example chess engine to use, go to -

http://www.rybkachess.com/index.php?auswahl=Demo+version

- and download the free Rybka 2.2n2 zip file. Download the file and extract its contents to the 'Chess Engines' folder that is located in the Winboard_X folder.

Depending on which kind of operating system you have would determine which of the Rybka engines you use. I have a 32 bit operating system so I delete everything from the folder except the 32 bit version of Rybka.

Also of note is that this is a multi-processor version of Rybka. I have a single processor computer but no worries, the engine will run just fine in it too. Rybka does not come with an opening book so we will look at that later.

In the Chess Engines folder that is located in the Winboard_X folder I have now made a folder called 'Rybka 2.2n2'.

and I have moved the chess engine I am using in this example (Rybka 2.2n2) from the Chess Engines folder to that newly made 'Rybka 2.2n2' folder.

If you want you can also rename the Rybka exe file to a shorter name as I have done.

Now it is time to make a polyglot.ini file for the polyglot.exe file to use.

Go to the How to Make a Polyglot ini File Post for information on how the making of a polyglot.ini file is accomplished.

Move this newly made polyglot.ini file to the Polyglot folder that is in the Winboard_X folder.

At this point in the Polyglot folder I make another folder called Rybka 2.2n2, and I move the polyglot.exe file, the polyglot.ini file, and since it is being used, the cygwin1.dll file to this Rybka 2.2n2 folder. This is being done so that in the future if it is wished to add other UCI engines for use with the Winboard GUI, each engine can have its own folder in the Polyglot folder. Each chess engine would need to use its own separate polyglot.ini file.

Now since Rybka 2.2n2 does not come with an opening book we will download one and put it in the Rybka 2.2n2 folder where the chess engine is. The book could be saved to anywhere you want but for the example we will put it in the folder with the chess engine.

Go to - http://wbec-ridderkerk.nl/html/download.htm - and on the page will be seen:

"Some PolyGlot books made by: Marc Lacrosse!"

For the example we will download the performance.bin rar file and extract its contents to the Rybka 2.2n2 folder.

This is what is in the Rybka 2.2n2 chess engine folder now.

A note on the opening books used with Polyglot. The opening books to be used with Polyglot have a bin extension. These are the only opening books that Polyglot can use. Polyglot has the capability to make opening books and it can only use opening books that were made by it. Some UCI engines have their own opening books and do not require that a Polyglot book be used with them. Since Rybka in this example does not have the capability to use its own opening book you have to use a Polyglot book if using Rybka in conjunction with Polyglot - and if you want to use an opening book at all.

Another place on the Internet where Polyglot books can be downloaded is Guenther Simon's website here:

http://www.rwbc-chess.de/ - click the 'Downloads' link underneath the heading 'RWBC'.

We now have a downloaded opening book in Rybka's engine folder. So now we go to the Polyglot folder, and to its Rybka 2.2n2 folder, and open the polyglot.ini file with a text editor - opening it with notepad is fine.

In the below graphic the important part to show is that the path to the Polyglot book has been manually changed to point to the performance.bin opening book file that was put into the Rybka 2.2n2 folder. Notice the path points to the actual file itself and that the Book= entry above the BookFile= entry has been set to - true. If we were not using a Polyglot book we would set it as Book=false. Also notice in the EngineDir= entry that the path only leads to the 'folder' that the Rybka 2.2n2 engine file is in, and not the engine file itself.

Now go to the Winboard_X folder and open the winboard.ini file with a text editor.

Find the below entry shown in the graphic in the winboard.ini file. What is shown is the area where the path to the chess engine is set so that the Winboard GUI can communicate with the chess engine. Since Winboard cannot communicate with UCI engines we are using the Polyglot adapter to do the exchanging of communication between the chess engine and the Winboard GUI. The Polyglot exe file in turn uses the polyglot.ini file to know what command options to receive and send. So in this example case, instead of inputting the data for the chess engine's path as would be done for a normal Winboard chess engine. We input the data for the path to the Polyglot exe file.

This is the winboard.ini file with the data entered for pointing to the Rybka 2.2n2 chess engine. The Rybka data is actually one line, but I have word wrap selected in notepad.

This is the entry shown in the above graphic displayed as code -

Code:

}

/firstChessProgramNames={"Rybka 2.2n2" /fd="C:\Program Files\Winboard_X\Polyglot\Rybka 2.2n2" /fcp='polyglot'

}

/secondChessProgramNames={GNUChess

"GNUChes5 xboard"

}

A word about the above path entry structure that is shown in the above code and graphic. Winboard only understands certain syntax; I guess syntax is the correct word to use. Anyway the -

Code:

"Rybka 2.2n2" /fd="C:\Program Files\Winboard_X\Polyglot\Rybka 2.2n2" /fcp='polyglot'

- line has to be structured in a way that the Winboard GUI will understand, or it will not work. I figured out how to structure it by trial and error from what I read in the Winboard help file. Even though I structure it this way and it works for me, I have seen examples where other people structure some things differently than I do and I can only assume that the way they do it works for them. I do not have an explanation for this except maybe in cases where some things appear different, we are all still following certain guidelines that are established for Winboard.

Winboard_X does not come with a Winboard help file. To get a help file I had to download the original Winboard 4.2.7 from Tim Mann's website, install it and then copy, or move, the help file to my Winboard_X folder. Even though the 4.2.7 help file is not updated to the Winboard_X GUI, the information in it is still relevant.

These are the actual currently used chess engine entries for my winboard.ini file -

Code:

}

/firstChessProgramNames={"Delfi 5.3b - 1000 Elo" /fd="C:\Program Files\Chess\Chess Engines\Delfi\Delfi 5.3b" /fcp='DelfiT'

"Delfi 5.4 - 1500 Elo" /fd="C:\Program Files\Chess\Chess Engines\Delfi\Delfi 5.4" /fcp='DelfiT'

"Hiarcs 10 - 1250 Elo" /fd="C:\Program Files\Chess\Polyglot\Hiarcs\Hiarcs 10" /fcp='polyglot'

"Hiarcs 11.1 - 1500 Elo" /fd="C:\Program Files\Chess\Polyglot\Hiarcs\Hiarcs 11.1" /fcp='polyglot'

"ProDeo 1.6 UCI - Absolute Novice Player" /fd="C:\Program Files\Chess\Polyglot\ProDeo 1.6\Absolute Novice Player" /fcp='polyglot'

"ProDeo 1.6 UCI - Average Club Player" /fd="C:\Program Files\Chess\Polyglot\ProDeo 1.6\Average Club Player" /fcp='polyglot'

"ProDeo 1.6 UCI - Strong Club Player" /fd="C:\Program Files\Chess\Polyglot\ProDeo 1.6\Strong Club Player" /fcp='polyglot'

"Rybka 1.2f - 1500 Elo" /fd="C:\Program Files\Chess\Polyglot\Rybkas\Rybka 1.2f" /fcp='polyglot'

"Rybka 2.3.2a - 1500 Elo" /fd="C:\Program Files\Chess\Polyglot\Rybkas\Rybka 2.3.2a" /fcp='polyglot'

"Ufim 8.02 - 1500 Elo" /fd="C:\Program Files\Chess\Polyglot\Ufim 8.02" /fcp='polyglot'

}

/secondChessProgramNames={GNUChess

"GNUChes5 xboard"

}

Notice that the /secondChessProgramNames= field is left at the default entries in my winboard.ini file. In other words I have left the /secondChessProgramNames= section blank. That is because I don't play many chess engine versus chess engine games. If I do play any engine vs. engine matches then I would fill in the secondChessProgramNames= fields. If you want to play engine vs. engine matches with Winboard then you would fill in this area. Just it would use /sd and /scp where required instead of /fd and /fcp.

There are too many things about the entries in the winboard.ini file to be covered here but two things that can be done is for games played through the GUI to be saved to a Pgn file (You have to set the path to the actual pgn file), and with Winboard_X chess fonts can be used for the pieces instead of bitmaps. I have read where some people have problems with Winboard_X in using chess piece fonts with it but I have had no problem with using Chessbase's Fritz font with it, and other chess piece fonts can also be used with it instead.

Now go to the Winboard_X folder and double-click the winboard_x exe file. Make sure that "Play against a chess engine or match two engines" is selected. Since there is only one engine installed (Rybka 2.2n2) that is the one selected. Click the OK button.

One thing to do is to select 'Board' from the 'Options' menu and make sure 'Moderate' board size is selected. On my computer anyway the moderate board size fills the screen very well. I should note that I use a 800 x 600 screen resolution, so I don't know how things will look at higher resolutions - Maybe o.k., maybe not.

Then in the below example I go to 'Mode' in the menu and select 'Show Engine Output' and 'Show Move History'.

I then move the Engine Output and Move History windows to where I want them.

Go to 'Options > Time Control' to set the game times

To have Rybka play as the white pieces go to 'Mode > Machine White'

And here Rybka makes the first move

And going to 'Action > Abort' - I abort the game. If I wanted to play the actual game I would move one of the black pieces instead.

Two things especially to look at in the Winboard GUI not shown here would be 'Options > General' and 'Options > Engines'.

This is basically all the information I can give, it by no means covers everything. Further information can be found through self-discovery and through searching on the Internet or via a knowledgeable friend, and definitely through reading the documentation that comes with Polyglot, and Winboard (whichever version is being used).

***************************************************

Here is a visual representation of what the folder (directory) structure would look like if the above posting were followed.

Once it is learned that the paths in the polyglot.ini and winboard.ini files just need to point to the correct places, the folders can be kept pretty much wherever the person using them wants them to be.

This is how I have my folders structured.

Author:Charles Browne

Last edited by Charles Browne on Fri Nov 07, 2008

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 -

http://www.msbsoftware.it/delfi/

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.