Jan 30, 2009

[Other] Pains of the xboard protocol

As you know Mediocre supports both the UCI and xboard protocols (although it's always supported UCI a bit better). But fact is it hardly really supports xboard, there is atleast one bug that I know of (when playing multiple games) that causes Mediocre to play illegal moves.

I've not wanted to touch it since frankly I find xboard annoying and confusing.

But while implementing pondering I had to start digging in the mess again.

For UCI it took about an hour to get it to work, possibly with a bug or two (I haven't tried it extensively yet).

When trying to do the same for xboard I had to change a ton of things, mainly due to xboard thinking for some reason that it's a good idea to not give any information whatsoever to the engine.

The clearest example of this is UCI sending "go ponder" when it's time for the engine to ponder, and the neat little "ponderhit" UCI sends if the next move from the opponent is the same move as the engine said it was pondering on. If it wasn't a ponderhit UCI simply sends a new search-string.

Even if the pondering is not implemented like this (picking a move and thinking on it), the information can still be easily used to control the thinking (starting and stopping pondering).

Xboard does nothing, except telling the engine "hard" at the beginning of the game (logical choice of command I know).

When the opponent moves, the commands are sent as usual, even though the engine is pondering.

This completely messed up my way of handling interrupt of the search. Since I now have to store the commands sent during search (or else the engine will "forget" what move was played since the same command is used to tell the engine to stop ponder).

Ok I'll stop ranting for now. :) Atleast ponder will be done soon, if xboard allows me to.


Anonymous said...

Hi mr.

Nice weblog detailing all your work with your engine. Congratulations! Great job!

What do you think about a neural network chess engine?

Jonatan Pettersson said...

Thank you!

About a neural network chess engine I have thought about adding a neural net for either picking moves or evaluating positions. As a complement to the rest.

However this seems to fall short due to neural nets are quite slow, and need a vast amounts of information to train on.

A pure neural net chess engine is an interesting idea though, but probably quite hard to get working at a reasonably high level.

Anonymous said...

did you stop writing new functionalities to mediocre chess?
Please post more...=)

Jonatan Pettersson said...

I'm currently implementing ponder into Mediocre. It's been quite a pain (due to winboard as mentioned).

I will write a guide on how I did it when I get it all working.

And a new version should be ready fairly soon.

I'm glad you enjoy my blogging. :)

Joey Robert said...

I'd just like to say thanks for this blog, it's been an invaluable tool when writing my own chess engine in C#.

Anonymous said...


I agree 100% with what you say about pondering using winboard... a real pain comared with UCI! So much so, that I find it hard to implement it in a way to make use of a ponderhit as efficiently as Uci...

Good luck with Mediocre!

Richard Allbert (Lime)

Anonymous said...

Hey are you done with Mediocre Chess?

wink b said...


When's the next Deep Blue going to be released on us unsuspecting public? ;).

Jonatan Pettersson said...

Hehe, hardly deep blue but yeah. :)

I do have a version almost ready with ponder and a few other fixes. The problem is still the winboard protocol and it needs more testing.

Since I'm nearing the end of my university studies, free time is kind of sparse.

But be patient, the next version with ponder will come. :)

Anonymous said...

Hej min prins, jag fattar nada av din blogg, men du e söt ändå! Verkar som dina fans vill att du ska uppdatera den snaaart! Hoppas du sover som en prins så hörs vi imorgon! Ville bara lämna ett litet avstamp om du undrar vad jag gör här mitt i natten! Jag har brist på roliga internetsidor att besöka som svar på din fråga som jag la i mun på dig!
Puss/ C

Suji-san said...

I just want to say that I am really hoping that you are working on Mediocre. It's an awesome program that I hope will continue to get better.

Selçuk said...

To work, to work, to work :))

Chessforeva Dev said...

Look, man! What a shame :( Why all the Masters of chess engines' development don't understand the big need of chess on the web. Java is not only cross-platform. Java is WEB solution, sometimes better than fastest .exe. It can be hosted, for example. It uses client's computer resources and can do great job for web page (flash can't provide needed performance). And the page needs javascript interface. Just give a readme of how to put it on a web page's HTML and how to make a move, and set up initial position.
I am not able to produce great chess engine, but I am able to connect it to various chess resources on internet. That's publishing, blogging, people just who like games, really big world of internet. Why Xboard? I don't need Linux or Windows. Or maybe I have just cheap and stupid netbook with internet.I would disallow all the old standards if I could. Auuuuu, it's really pain. Consider that, Master.
Anyway, appreciate Your scientific style.
Best regards,
Chessforeva Dev

freshblood said...

Hello jonatan
I think a huge time passed without enter any post.So i want to ask you when time you will back again.

You are one of the reason to enter on the way of chess programming for me because when i decided to make my chess engine i was looking at resources on net pages and all of them get confused me . it was looking too complex and i couldnt put ideas together which i had read .they was looking so apart for me.When i found your page i surprised because i see that you blogged all of the story step by step with source files. Also your writing style was a kind of amateur soul.Well you encouraged the others in your first post. Think that you even encouraged me when i was hopeless to write my chess engine and also learn programming. other reason was you have used java .i thought that i can understand java if i know a little c# and that worked.

My engine strengh is not close to your engine but i coming day by day .

my other reason to start to write chess engine is to learn c# language in entertaining way.i see that i have improved myself day by day so i even can corrects some of your codes :)

Chessforeva Dev said...

I made this Mediocre 3D javascript version and it works! The source & sample for this java applet version is here. It's just compiled for v1.6.
Chessforeva Dev.