Thursday, January 12, 2012

Connecting Winboard to World Chess Live

Connecting Winboard to a chess-playing server such as World Chess Live isn’t easy for the first-timer, but it can be done. This article aims to walk you through the process. I’m going to try and make it very complete, so you may want to bookmark it for future use. This article assumes that you have a working copy of Winboard installed and that you have already created a (C)omputer account on WCL.

This article will be long, so be sure you read it all.

To start: Let’s go to your desktop (for now). When you get there, right-click on any blank area and scroll the mouse down to “New”. Then, choose “Text Document”, and a file will be created. You can name this file whatever you want, but make sure it’s something you’ll remember, like the C account name, which is what I use. After you name it, hit ENTER and step one is done. The extension will remain .txt, for now, and that’s fine; we’ll change it in a bit.

Filling in the file: Double-click the file so that it opens, if it isn’t already. Inside, we are going to put some pretty wacky things, so be patient. Winboard’s language is known as “Zippy”, so many things in this file will have the word Zippy in front of it. I know, weird. I will walk you through each item, what you should fill in, and what it means or does. Don’t worry.

The first thing you’ll want to do is put in the location for Winboard on your computer.

Example: "C:\Program Files (x86)\WinBoard-4.2.7\winboard.exe" -zp (and yes, you want the quotation marks. Also, make sure you put a space between the last quotes and the –zp; each and every space is important when setting up these files. If you have XP or Vista, your Winboard will have been installed in a slightly different location, and that’s okay; just put down wherever the .exe file is. It’ll be in Program Files somewhere. An easy way to get the file location, once you find the file, is to right-click it, go to “Properties”, and a box will open up. Copy what it says after “Location” into your new Winboard file.

Next: -ics –fcp is what you want to type after the Winboard .exe location. Again, put a space between the -zp after the Winboard location and the –ics and -fcp. “ics” stands for Internet Chess Server and “fcp” stands for First Chess Program, or the engine you’ll be using. The ics tells Winboard you won’t just be playing against it on your computer, but that you’ll be signing it onto a chess server. That’s all.

So far we have: "C:\Program Files (x86)\WinBoard-4.2.7\winboard.exe" -zp -ics –fcp
This is from my personal Winboard engine file; yours will differ slightly during each step depending on file location and your preferences.

The engine: Now we are going to want to tell Winboard which engine you are going to use, and its location. It’s the same process as the Winboard.exe bit, only you’ll change the path to wherever your engine is located on your computer. I suggest, for organizational purposes, putting the engine in your Winboard folder. To do this, right-click on your engine, wherever it is. Scroll down to “Cut”, and then go to the Winboard folder in Program Files. Right-click again on any blank space and scroll down to “Paste”. Done.

Example: "C:\Program Files (x86)\WinBoard-4.2.7\sf-211-win-eng\stockfish-211-32-ja.exe"

As you can see, the example location uses Stockfish as the engine. Yours will read whatever your engine’s name is. An easy way to get the engine location is to right-click it, go to “Properties”, and a box will open up. Copy what it says after “Location” into your new Winboard file. Easy, huh?

Now your file should look something like this: "C:\Program Files (x86)\WinBoard-4.2.7\winboard.exe" -zp -ics -fcp "C:\Program Files (x86)\WinBoard-4.2.7\sf-211-win-eng\stockfish-211-32-ja.exe"

Computer account name: Next, Winboard wants to know the name of your bot/computer account, so it can log it in to the chess server. That will look like this:
-icslogon "logonMortimer.ini"

Of course, you would replace Mortimer with your own bot’s handle on the chess server.

Now your file should look similar to this: "C:\Program Files (x86)\WinBoard-4.2.7\winboard.exe" -zp -ics -fcp "C:\Program Files (x86)\WinBoard-4.2.7\sf-211-win-eng\stockfish-211-32-ja.exe" -icslogon "logonMortimer.ini"

Playing site: Now Winboard will need to know the address of the site in which you will sign the bot onto. For World Chess Live, it will look like this:
"chess.worldchesslive.com" -icsport 5000

Again, pay attention to the spaces in between things. You can copy/paste this address directly into your file if you are signing your account on to WCL.

So now we have: "C:\Program Files (x86)\WinBoard-4.2.7\winboard.exe" -zp -ics -fcp "C:\Program Files (x86)\WinBoard-4.2.7\sf-211-win-eng\stockfish-211-32-ja.exe" -icslogon "logonMortimer.ini" -icshost "chess.worldchesslive.com" -icsport 5000 (We’re getting there!)

Now Winboard needs to know what lag control is in place at the server. For ICC/WCL it’s Timestamp, and for FICS it’s Timeseal. So you’ll type (or copy/paste):
-icshelper timestamp

So now our file looks like:
"C:\Program Files (x86)\WinBoard-4.2.7\winboard.exe" -zp -ics -fcp "C:\Program Files (x86)\WinBoard-4.2.7\sf-211-win-eng\stockfish-211-32-ja.exe" -icslogon "logonMortimer.ini" -icshost "chess.worldchesslive.com" -icsport 5000 -icshelper timestamp

Game End: Now Winboard needs to know what your bot will do after each game, such as seeking, saying something, rematching, etcetera. Here is an example:

-zippyGameEnd="seek 1 0 \nseek 3 0\nseek 15 0"

Note the “nseek” command. This is necessary for multiple seeks to be present. On most servers, a user can have up to three seeks out at once, which we enter in three separate seek commands. For bots, the first seek looks normal, and each subsequent seek is an nseek so that it can all be done in one command line. Also, note the backslash between seeks; a regular forward slash (/) will not work. You can, of course, change the seek parameters to anything you like, including wild variants (for engines that support them), increments, different time controls, etcetera. As long as it’s in between those quotes, it’s good to go.

Now we have:
"C:\Program Files (x86)\WinBoard-4.2.7\winboard.exe" -zp -ics -fcp "C:\Program Files (x86)\WinBoard-4.2.7\sf-211-win-eng\stockfish-211-32-ja.exe" -icslogon "logonMortimer.ini" -icshost "chess.worldchesslive.com" -icsport 5000 -icshelper timestamp -zippyGameEnd="seek 1 0 \nseek 3 0\nseek 15 0"

Password: In order to sign the bot on to the playing site, Winboard needs the password for the account. You do this by typing:

-zippyPassword="password" -xzab

Of course, you’ll replace password with whatever your C account’s password actually is. Pretty easy!

So now your file should look similar to:
"C:\Program Files (x86)\WinBoard-4.2.7\winboard.exe" -zp -ics -fcp "C:\Program Files (x86)\WinBoard-4.2.7\sf-211-win-eng\stockfish-211-32-ja.exe" -icslogon "logonMortimer.ini" -icshost "chess.worldchesslive.com" -icsport 5000 -icshelper timestamp -zippyGameEnd="seek 1 0 \nseek 3 0\nseek 15 0" -zippyPassword="password" –xzab

Other stuff: You are doing great. This is the last part for this file, I promise. The end of this file is where we can tell the bot certain things like how many times each opponent can play it in a row (reduces abuse), how long the break is in between the max games number and when the opponent can play it again, any variants the bot will play (such as crazyhouse or atomic chess), and the PGN file you want Winboard to save the games in. Winboard will create this file itself, you just need to name it. Here’s an example from my personal bot:

zippyMaxGames=20 -zippyReplayTimeout=60 -zippyVariants="normal" -sgf mortimer.pgn

This means that each opponent can only play my bot 20 times in a row before that person (or other C account) is forced to wait 60 seconds to play it again. This gives others who are waiting a chance to get in on the action. The numbers 20 and 60 can, of course, be changed to whatever you wish.

My bot is set up, as of right now, to only play regular, or normal, chess, and so that’s what I put after the variants option. Also, its games are stored in a file called Mortimer.pgn, which Winboard created after I put it in after –sgf (saved games file).

So, your completed *.bat file should look similar to this:
"C:\Program Files (x86)\WinBoard-4.2.7\winboard.exe" -zp -ics -fcp "C:\Program Files (x86)\WinBoard-4.2.7\sf-211-win-eng\stockfish-211-32-ja.exe" -icslogon "logonMortimer.ini" -icshost "chess.worldchesslive.com" -icsport 5000 -icshelper timestamp -zippyGameEnd="seek 1 0 \nseek 3 0\nseek 15 0" -zippyPassword="password" -xzab -zippyMaxGames=20 -zippyReplayTimeout=60 -zippyVariants="normal" -sgf mortimer.pgn

If you want, you can copy/past this directly into your *.bat file and just change the information so that it works on your machine. :)

Saving your file as *.bat. Okay, now we have to save this file in such a way that Windows knows it’s an executable batch file. To do this, click on “File” in the upper left of the text box, and “Save As”. A new box will pop up, and you can type the file name there. Mine is “Mortimer.bat” because my bot’s name is Mortimer on WCL.

Before you hit “Save”, look at the line just below the one that says “File name”. See where it says “Save as type:”? That is a drop-down bar. Click on the arrow on the right of the line to drop it down, and scroll to “All Files (*.*)”. What this does is make Windows realize it’s not just a text file with a *.bat extension, it’s an actual *.bat batch file that does something. NOW you can save, and we are done with the first file. The second file is far easier, trust me.

The *.ini file: Now we need to construct an initiation file for Winboard. It’s super easy and may seem redundant, but the two files work together to get our C account signed on. Make sure you save both the *.bat file and the *.ini file in the same place or folder on your computer. They have to “see” each other in order to work correctly.

First, create a file the same way you did the *.bat file by going to the desktop (or My Documents, or wherever you like; I only choose the desktop at first because it’s far less confusing sometimes), right-clicking, scrolling down to "New", and then choosing "Text Document".

The most important thing here is that your *.ini file name matches, exactly, the *.ini file name you specified back in the batch file. For mine, it read:

-icslogon "logonMortimer.ini"

Remember that guy? So, for an example, if your C account’s name was “ChessBot”, you would type “logonChessBot.ini” instead of Mortimer – see? Simple.

What to type: So, you have your blank new *.txt document open, and you are wondering what to do. My friend, I have great news: This is the easiest part.

Here is what will be in the *.ini file:


Bot name
Bot password
Set bell 0 (or 1, if you wish: it turns the piece movement sound on or off. 0 is off, and you’ll probably like it better in the long run. Up to you, though!)
Seek 1 0
Seek 5 0
Seek 15 0
Anything else

Wait. What is ‘Anything else’? This is anything else you’d like your bot to do when it logs in. For instance, you can have it shout something, you can send a tell to a certain channel, you can set the formula, etcetera. So, for instance, Mortimer’s *.ini file might look like:

Mortimer
Password
Set bell 0
Shout I’m ready for battle!
Set formula rated
Seek 1 0
Seek 3 0
Seek 15 0

Save the file: Now we save the file the same way we did with the batch file, dropping down to “All Files” and naming it *******.ini. Again, make sure this file name matches the one in your batch file. If it doesn’t, the bot won’t sign on.

And that’s it! There are a few common errors folks might make, and I’ll try my best to list three or four of them here so that you have an idea where to start and what to look for should you encounter a problem.

Spacing. I cannot stress how important it is to get the spacing correct between the zippy commands in the *.bat file. If Winboard doesn’t fire up at all or disappears right away, or it has trouble connecting to the site, this could be the reason. Check and double check it.

File name mix-up: As I said, it’s uber-important that what you specified in the *.bat and what you named the *.ini file names match up as far as the logon part. If not, they can’t speak to each other and Winboard will close down or, at the very least, not sign the bot in to the server.

Engine is bad: Sometimes, an engine (especially if pirated, which I never, ever condone) gets messed up and won’t load. If that happens, you’ll see “Starting Chess Program” on the top left of the chessboard, and then Winboard will either just sit there or shut down altogether. If this happens, I highly recommend trying another engine. There are plenty out there to choose from. Also, sometimes an engine will “load”, but then won’t make any moves once you get to the server. Probably also a corrupt engine. Change it out.

Engines: Engines MUST be *.exe (UCI – Universal Chess Interface) in order to work with Winboard. Engines with *.eng suffix, such as those that come with Fritz, will not load.

There are a ton of free and powerful engines out there, such as Houdini, Stockfish, and some versions of Rybka.

Houdini: http://www.cruxis.com/chess/houdini.htm (Go about halfway down the page. You’ll see the blue link that says, “Too expensive? You can still download the free Houdini 1.5 which at the time of the Houdini 2 release remains unmatched in strength by any other chess engine.”)

Stockfish: http://www.stockfishchess.com/download/

You can also do an Internet search for “Free chess engines” and you’ll probably come back with more than you can handle. If you are interested in a specific engine and cannot find it, contact me directly and we’ll see what we can do. I have collected quite a few (hundred) over the years. #totalnerd

Winboard stuff: http://www.tim-mann.org/chess.html (This is a GREAT page for Winboard users, as it has engines, Zippy stuff, links, and all kinds of other things. It’s where most of the Winboard pros get their start.

Just know that almost any chess engine that ends in *.exe and isn’t corrupt will work fine in Winboard. If you can find it, Winboard will make it play. That’s why so many folks like Winboard over other programs such as Chess Partner or Arena. It isn’t picky one bit with its engines, unless they are corrupt or have a virus or something.

I hope you have found this article helpful. If you have suggestions or see anything wrong, leave me a comment below or email me directly at: derekodm at gmail dot com (link left out so spam bots cannot find me!). Thanks for your time.

No comments:

Post a Comment