Ubuntu Linux and Chess -- Engines

Avatar of delatbabel
| 0

There are a lot of chess engines available, and you can find a more full list on this wikipedia page: http://en.wikipedia.org/wiki/Chess_engine

Here I'm only going to discuss the freely available ones that you will be able to install easily on Ubuntu.  You will hear some of the GMs on this site discussing Houdini and Rybka, however the current version of Rybka is not free, and Houdini is only for Windows.

In the list of engines that I installed in my "Installation" post you will have seen fairymax, stockfish, fruit, glaurung, toga2, hoichess, sjeng, phalanx, crafty, gnuchess, and possibly some others.  You may find many other chess engines for free use on the internet, and if you want you can download and perhaps compile some of those.  You can find wikipedia articles discussing the strength and weakness of each engine.  Personally I like the stockfish engine, and if you're not a grandmaster level player you will find this will give you more than a challenge.

I am not going to go into the details of each engine, but I will quickly give you a summary of how each engine works.  Firstly, you will note that some engines use the xboard protocol, and some use the UCI protocol.

Each chess engine has a command line program, which you need to run to launch the chess engine. So, for example, gnuchess comes with a command line program called "gnuchess".  To launch that, start a terminal window (either your regular terminal program or konsole or similar) and type the name of the engine, e.g:

gnuchess

If the chess engine is xboard protocol then it will probably send out a long list of introductory information, and issue a prompt.  Something like this:

GNU Chess 5.07
Adjusting HashSize to 1024 slots
Transposition table:  Entries=1K Size=48K
Pawn hash table: Entries=0K Size=32K
White (1) :

You can actually play one of these engines right there in your terminal.  Moves are entered in standard algebraic notation, so if you type in the move "e4" you will see a response like this:

White (1) : e4
1. e4

black  KQkq  e3
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . P . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R

Thinking...
Looking for opening book in book.dat...
Looking for opening book in /usr/share/games/gnuchess/book.dat...
Read opening book (/usr/share/games/gnuchess/book.dat)...
Loading book from /usr/share/games/gnuchess/book.dat.
40304 hash collisions...  Opening database: 265053 book positions.
 In this position, there are 11 book moves:
 Nc6(71/77/22/32)  Nf6(54/113/88/113)  a6(75/3/1/0)  b6(67/11/3/9)
 c6(52/451/376/743)  d6(52/178/153/229)  e6(52/651/582/970)  g6(59/155/88/117)
 c5(56/2535/1691/2912)  d5(54/47/38/35)  e5(54/2518/1938/3369) 
 
 c5(1322)  e5(1312)  e6(376)  c6(277)  d6(141)  g6(136)  Nf6(109)  Nc6(108)
 a6(76)  d5(76)  b6(70) 
 

white  KQkq  e6
r n b q k b n r
p p p p . p p p
. . . . . . . .
. . . . p . . .
. . . . P . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R


My move is : e5
White (2) :

wow ... all of that for one move.  Well, of course that's not the real way you'd use an engine, you'd plug it into one of the real UI programs and play that way.

What does a UCI engine look like?  We will try the one I use, stockfish:

stockfish
Stockfish 2.1.1 64bit by Tord Romstad, Marco Costalba and Joona Kiiski

... not much information there.  If I type a move such as "e4" then I will get a response like this: Unknown command: e4

The UCI protocol itself is documented on this web page: http://wbec-ridderkerk.nl/html/UCIProtocol.html and you can go read about it there if you like, but right now we're just trying to work out if we have a UCI engine or not.  To test this, type in the following commands, and you should see some output and then the program will exit:

uci
go
quit

So now, armed with a list of engines and knowing whether each is xboard or UCI, we can start plugging them in to our UI.  Next post for that.