A Chess forum. ChessBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ChessBanter forum » Chess Newsgroups » rec.games.chess.computer (Computer Chess)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

UCI Engine Bindings



 
 
Thread Tools Display Modes
  #1  
Old September 17th 09, 01:15 PM posted to rec.games.chess.computer
Martin Brown
external usenet poster
 
Posts: 907
Default UCI Engine Bindings

I have the sourcecode (somewhat modified) for an old VAX chess engine
originally written in PASCAL and now in Modula2.

I have written a UCI binding for it to place it under the ChessBase GUI
and in testing I have run into a problem. I cannot persuade the info
command to work - what I send back is mostly ignored by the GUI. I have
clearly got something wrong but it isn't obvious from the debug log.

The bestmove command works OK so it is playable but without any feedback
on how the engine thinks it is doing. Every move is reported as 0.01/0

A sample info command is something like:

info score cp -557 time 123 depth 3 nodes 18405 pv e4e5

followed by

bestmove e4e5

The second line is acted upon so I must have the termination characters
right. But the main info command is stubbornly ignored. I am doing
something wrong but I cannot see what it is.

I hardwired a few test cases and discovered that

info depth 4

sets the depth OK and causes the bestmove/pv to display.

info time 123
info score cp -557

on their own do nothing.

info string rhubarb

also doesn't display.

Thanks for any tips of guidance on how to get the syntax of the info
command or the semantics right.

Regards,
Martin Brown
  #2  
Old September 17th 09, 02:53 PM posted to rec.games.chess.computer
Simon Krahnke
external usenet poster
 
Posts: 470
Default UCI Engine Bindings

* (14:15) schrieb:

Thanks for any tips of guidance on how to get the syntax of the info
command or the semantics right.


Your lines look ok for me. Tried another interface like Arena or
Shredder Classic?

mfg, simon .... l
  #3  
Old September 17th 09, 06:45 PM posted to rec.games.chess.computer
Tony M
external usenet poster
 
Posts: 168
Default UCI Engine Bindings

On Thu, 17 Sep 2009 13:15:07 +0100, Martin Brown
wrote:

I have the sourcecode (somewhat modified) for an old VAX chess engine
originally written in PASCAL and now in Modula2.

I have written a UCI binding for it to place it under the ChessBase GUI
and in testing I have run into a problem. I cannot persuade the info
command to work - what I send back is mostly ignored by the GUI. I have
clearly got something wrong but it isn't obvious from the debug log.

The bestmove command works OK so it is playable but without any feedback
on how the engine thinks it is doing. Every move is reported as 0.01/0

A sample info command is something like:

info score cp -557 time 123 depth 3 nodes 18405 pv e4e5

followed by

bestmove e4e5

The second line is acted upon so I must have the termination characters
right. But the main info command is stubbornly ignored. I am doing
something wrong but I cannot see what it is.

I hardwired a few test cases and discovered that

info depth 4

sets the depth OK and causes the bestmove/pv to display.

info time 123
info score cp -557

on their own do nothing.

info string rhubarb

also doesn't display.

Thanks for any tips of guidance on how to get the syntax of the info
command or the semantics right.

Regards,
Martin Brown


Does the output display ok in another GUI, like Arena or Shredder?
The Chessbase GUIs tend to massage UCI output. For example, a command
like

info string rhubarb

will display nothing in Chessbase, but will appear in other GUIs.
Chessbase GUIs also tend to massage PV output, in an attempt to
convert them to SAN. Maybe also try reording your info command to
look something like:

info depth 3 seldepth 3 score cp -199 time 123 nodes 12241 pv e4e5

It seems most engines send the info in that order.
  #4  
Old September 17th 09, 07:29 PM posted to rec.games.chess.computer
Simon Krahnke
external usenet poster
 
Posts: 470
Default UCI Engine Bindings

* Tony M (19:45) schrieb:

Chessbase GUIs also tend to massage PV output, in an attempt to
convert them to SAN.


Arena does that too, what's wrong with it?

The UCI protocol specifies in what format the PV moves have to be, so
one can try to parse them.

mfg, simon .... l
  #5  
Old September 17th 09, 08:15 PM posted to rec.games.chess.computer
Tony M
external usenet poster
 
Posts: 168
Default UCI Engine Bindings

On Thu, 17 Sep 2009 20:29:31 +0200, Simon Krahnke
wrote:

* Tony M (19:45) schrieb:

Chessbase GUIs also tend to massage PV output, in an attempt to
convert them to SAN.


Arena does that too, what's wrong with it?


There's nothing wrong with massaging PV output, but to me there's
something wrong with massaging info string output into /dev/null.
  #6  
Old September 18th 09, 10:26 AM posted to rec.games.chess.computer
Martin Brown
external usenet poster
 
Posts: 907
Default UCI Engine Bindings

Tony M wrote:
On Thu, 17 Sep 2009 13:15:07 +0100, Martin Brown
wrote:

I have the sourcecode (somewhat modified) for an old VAX chess engine
originally written in PASCAL and now in Modula2.

I have written a UCI binding for it to place it under the ChessBase GUI
and in testing I have run into a problem. I cannot persuade the info
command to work - what I send back is mostly ignored by the GUI. I have
clearly got something wrong but it isn't obvious from the debug log.

The bestmove command works OK so it is playable but without any feedback
on how the engine thinks it is doing. Every move is reported as 0.01/0

A sample info command is something like:

info score cp -557 time 123 depth 3 nodes 18405 pv e4e5

followed by

bestmove e4e5

The second line is acted upon so I must have the termination characters
right. But the main info command is stubbornly ignored. I am doing
something wrong but I cannot see what it is.

I hardwired a few test cases and discovered that

info depth 4

sets the depth OK and causes the bestmove/pv to display.

info time 123
info score cp -557

on their own do nothing.

info string rhubarb

also doesn't display.

Thanks for any tips of guidance on how to get the syntax of the info
command or the semantics right.

Regards,
Martin Brown


Does the output display ok in another GUI, like Arena or Shredder?


I didn't try other GUIs. I only have Chessbase ones. Does the latest
Shredder come with its own custom GUI now? Shredder10 is Chessbase.
Sounds like Arena would be better for what I want to do here.

The Chessbase GUIs tend to massage UCI output. For example, a command
like

info string rhubarb

will display nothing in Chessbase, but will appear in other GUIs.


OK. And is there an easy way to switch engine debug mode on in the
Chessbase GUI or Arena? It is a bit clunky having to configure the
engine to toggle it on/off.

Arena might be handy for testing then. I miss having a debug screen for
engine error messages to appear on when things go haywire. And it is a
bit tedious manually testing to the UCI interface specs.

In debug mode it draws an ASCII copy of its internal board (or rather
tries to using info string commands). It seems that part works for
normal moves. I am not convinced that en passant captures and pawn
promotions are right yet under the new GUI.

I was somewhat surprised that UCI engines are sent the entire game
sequence every move rather than just the next move played or a FEN
representation of the current position.

Chessbase GUIs also tend to massage PV output, in an attempt to
convert them to SAN. Maybe also try reording your info command to
look something like:

info depth 3 seldepth 3 score cp -199 time 123 nodes 12241 pv e4e5

It seems most engines send the info in that order.


Thanks very much. This seems to have done the trick. It started off in
that order but without the seldepth (because for testing it is very
simple minded 2 ply feedover like the original program). Including that
term seems and using this sequence of keywords seems to make it work OK.
My but Chessbase is tetchy about exact keyword ordering!

Thanks for your help. I might have eventually found this by trial and
error or dissecting someone elses sourcecode. This was a lot quicker.

Now I have another question about multipv mode (from the spec).

* multipv this for the multi pv mode.
for the best move/pv add "multipv 1" in the string when you send the pv.
in k-best mode always send all k variants in k strings together.

I am guessing

info depth 3 seldepth 3 score cp -199 time 123 nodes 12241 multipv 1 e4e5

and then a sequence of similar ones 2..N.

I would like an example of a multipv string that is known to work please...

Regards,
Martin Brown
  #7  
Old September 18th 09, 04:39 PM posted to rec.games.chess.computer
Tony M
external usenet poster
 
Posts: 168
Default UCI Engine Bindings

On Fri, 18 Sep 2009 10:26:12 +0100, Martin Brown
wrote:

OK. And is there an easy way to switch engine debug mode on in the
Chessbase GUI or Arena? It is a bit clunky having to configure the
engine to toggle it on/off.

Arena might be handy for testing then. I miss having a debug screen for
engine error messages to appear on when things go haywire. And it is a
bit tedious manually testing to the UCI interface specs.


It's pretty easy in Arena. Arena has a Debug Window that shows all
the I/O between GUI and engine(s). I found it handy, not only for
debugging, but also for observing how other engines format their
output.


I was somewhat surprised that UCI engines are sent the entire game
sequence every move rather than just the next move played or a FEN
representation of the current position.


As a Winboard programmer, that always seemed weird to me.

Now I have another question about multipv mode (from the spec).

* multipv this for the multi pv mode.
for the best move/pv add "multipv 1" in the string when you send the pv.
in k-best mode always send all k variants in k strings together.

I am guessing

info depth 3 seldepth 3 score cp -199 time 123 nodes 12241 multipv 1 e4e5

and then a sequence of similar ones 2..N.

I would like an example of a multipv string that is known to work please...


Here's a sample of Rybka 2.3.2a's output, from an Arena debug window:

Arena 1.1
5953**-------------NewGame!!!-------------
17953*1*-------------------Starting engine 1
Rybkav2.3.2a.mp.w32--------------------
17953*1*Configured Engine 1 Type: UCI
18094*1*Engine 1 dir: C:\Games\Chess\Winboard\Rybka 2.3.2A (All
Versions)\Rybka 2.3.2a
18156*1*Engine 1 commandline: "C:\Games\Chess\Winboard\Rybka 2.3.2A
(All Versions)\Rybka 2.3.2a\Rybkav2.3.2a.mp.w32.exe"
188911:uci
189531:id name Rybka 2.3.2a mp 32-bit
190161:id author Vasik Rajlich
190161ption name Hash type spin min 2 max 4096 default 32
190161ption name Max CPUs type spin min 1 max 2048 default 2048
190161ption name Display PV Tips type check default false
190161ption name CPU Usage type spin min 1 max 100 default 100
190161ption name Win Percentage to Hash Usage type check default
false
190161ption name Display Current Move type check default true
190161ption name NalimovPath type string default empty
190161ption name NalimovCache type spin min 1 max 256 default 1
190311ption name NalimovUsage type combo default Rarely var
Frequently var Normally var Rarely var Never
190311ption name Preserve Analysis type check default false
190471ption name Clear Hash type button
190471ption name Ponder type check default true
190471ption name MultiPV type spin default 1 min 1 max 100
190471ption name UCI_LimitStrength type check default false
190471ption name UCI_Elo type spin default 1200 min 1200 max 2400
191091ption name Server Buffer type check default false
191721ption name UCI_AnalyseMode type check default false
192341ption name UCI_Opponent type string default empty
192971ption name UCI_EngineAbout type string default
www.rybkachess.com
193591ption name Contempt type spin default 0 min -100 max 100
194221ption name Outlook type combo default Neutral var Very
Pessimistic var Slightly Pessimistic var Neutral var Slightly
Optimistic var Very Optimistic var Ultra Optimistic
194841ption name Rate Of Play type combo default Normal var
Ultraslow var Slow var Normal var Fast var Ultrafast
194841ption name Time Usage type combo default Varied var Constant
var Varied
195471ption name Emergency Time Buffer type combo default Medium
var Small var Medium var Large
195471:uciok
197501:setoption name Hash value 256
197501:setoption name NalimovPath value C:\Games\Chess\Tablebases
197501:setoption name NalimovCache value 32
197501:isready
220001:readyok
261721:setoption name MultiPV value 10
261721:info string displaying 10 variations
284531:isready
284841:readyok
286091:ucinewgame
286091:isready
289691:readyok
290311osition startpos
290311:go infinite
291411:info depth 5
291871:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
291871:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
291871:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
291871:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
291871:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
291871:info multipv 3 depth 5 score cp 6 hashfull 0 time 142 nodes
3928 nps 28325 pv d2d3 b8c6
291871:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
291871:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
291871:info multipv 3 depth 5 score cp 6 hashfull 0 time 142 nodes
3928 nps 28325 pv d2d3 b8c6
291871:info multipv 4 depth 5 score cp 0 hashfull 0 time 157 nodes
4440 nps 28958 pv e2e3 b8c6
292191:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
292191:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
292191:info multipv 3 depth 5 score cp 6 hashfull 0 time 142 nodes
3928 nps 28325 pv d2d3 b8c6
292191:info multipv 4 depth 5 score cp 6 hashfull 0 time 173 nodes
4905 nps 29033 pv d2d4 g8f6
292191:info multipv 5 depth 5 score cp 0 hashfull 0 time 157 nodes
4440 nps 28958 pv e2e3 b8c6
292191:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
292191:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
292191:info multipv 3 depth 5 score cp 6 hashfull 0 time 142 nodes
3928 nps 28325 pv d2d3 b8c6
292191:info multipv 4 depth 5 score cp 6 hashfull 0 time 173 nodes
4905 nps 29033 pv d2d4 g8f6
292191:info multipv 5 depth 5 score cp 0 hashfull 0 time 157 nodes
4440 nps 28958 pv e2e3 b8c6
292191:info multipv 6 depth 5 score cp -12 hashfull 0 time 173 nodes
5116 nps 30281 pv b1a3 b8c6
292191:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
292191:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
292191:info multipv 3 depth 5 score cp 6 hashfull 0 time 142 nodes
3928 nps 28325 pv d2d3 b8c6
292341:info multipv 4 depth 5 score cp 6 hashfull 0 time 173 nodes
4905 nps 29033 pv d2d4 g8f6
292341:info multipv 5 depth 5 score cp 0 hashfull 0 time 157 nodes
4440 nps 28958 pv e2e3 b8c6
292341:info multipv 6 depth 5 score cp -12 hashfull 0 time 173 nodes
5116 nps 30281 pv b1a3 b8c6
292341:info multipv 7 depth 5 score cp -15 hashfull 0 time 189 nodes
5349 nps 28980 pv b2b3 g8f6
292501:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
292501:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
292501:info multipv 3 depth 5 score cp 6 hashfull 0 time 142 nodes
3928 nps 28325 pv d2d3 b8c6
292501:info multipv 4 depth 5 score cp 6 hashfull 0 time 173 nodes
4905 nps 29033 pv d2d4 g8f6
292501:info multipv 5 depth 5 score cp 0 hashfull 0 time 157 nodes
4440 nps 28958 pv e2e3 b8c6
292501:info multipv 6 depth 5 score cp -12 hashfull 0 time 173 nodes
5116 nps 30281 pv b1a3 b8c6
292501:info multipv 7 depth 5 score cp -15 hashfull 0 time 189 nodes
5349 nps 28980 pv b2b3 g8f6
292501:info multipv 8 depth 5 score cp -18 hashfull 0 time 204 nodes
5544 nps 27828 pv g2g3 g8f6
292501:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
292501:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
292501:info multipv 3 depth 5 score cp 6 hashfull 0 time 142 nodes
3928 nps 28325 pv d2d3 b8c6
292501:info multipv 4 depth 5 score cp 6 hashfull 0 time 173 nodes
4905 nps 29033 pv d2d4 g8f6
292661:info multipv 5 depth 5 score cp 0 hashfull 0 time 157 nodes
4440 nps 28958 pv e2e3 b8c6
292661:info multipv 6 depth 5 score cp -9 hashfull 0 time 220 nodes
5938 nps 27638 pv g1h3 g8f6
292661:info multipv 7 depth 5 score cp -12 hashfull 0 time 173 nodes
5116 nps 30281 pv b1a3 b8c6
292661:info multipv 8 depth 5 score cp -15 hashfull 0 time 189 nodes
5349 nps 28980 pv b2b3 g8f6
292661:info multipv 9 depth 5 score cp -18 hashfull 0 time 204 nodes
5544 nps 27828 pv g2g3 g8f6
292971:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
292971:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
292971:info multipv 3 depth 5 score cp 6 hashfull 0 time 142 nodes
3928 nps 28325 pv d2d3 b8c6
292971:info multipv 4 depth 5 score cp 6 hashfull 0 time 173 nodes
4905 nps 29033 pv d2d4 g8f6
292971:info multipv 5 depth 5 score cp 0 hashfull 0 time 157 nodes
4440 nps 28958 pv e2e3 b8c6
292971:info multipv 6 depth 5 score cp -9 hashfull 0 time 220 nodes
5938 nps 27638 pv g1h3 g8f6
292971:info multipv 7 depth 5 score cp -10 hashfull 0 time 251 nodes
6550 nps 26721 pv e2e4 g8f6
292971:info multipv 8 depth 5 score cp -12 hashfull 0 time 173 nodes
5116 nps 30281 pv b1a3 b8c6
292971:info multipv 9 depth 5 score cp -15 hashfull 0 time 189 nodes
5349 nps 28980 pv b2b3 g8f6
292971:info multipv 10 depth 5 score cp -18 hashfull 0 time 204 nodes
5544 nps 27828 pv g2g3 g8f6
293281:info multipv 1 depth 5 score cp 6 hashfull 0 time 126 nodes
3496 nps 28411 pv b1c3 b8c6
293281:info multipv 2 depth 5 score cp 6 hashfull 0 time 126 nodes
3697 nps 30045 pv g1f3 b8c6
293281:info multipv 3 depth 5 score cp 6 hashfull 0 time 142 nodes
3928 nps 28325 pv d2d3 b8c6
293281:info multipv 4 depth 5 score cp 6 hashfull 0 time 173 nodes
4905 nps 29033 pv d2d4 g8f6
293281:info multipv 5 depth 5 score cp 0 hashfull 0 time 157 nodes
4440 nps 28958 pv e2e3 b8c6
293281:info multipv 6 depth 5 score cp -1 hashfull 0 time 267 nodes
6943 nps 26627 pv c2c4 g8f6
293281:info multipv 7 depth 5 score cp -9 hashfull 0 time 220 nodes
5938 nps 27638 pv g1h3 g8f6
293281:info multipv 8 depth 5 score cp -10 hashfull 0 time 251 nodes
6550 nps 26721 pv e2e4 g8f6
293281:info multipv 9 depth 5 score cp -12 hashfull 0 time 173 nodes
5116 nps 30281 pv b1a3 b8c6
293281:info multipv 10 depth 5 score cp -15 hashfull 0 time 189 nodes
5349 nps 28980 pv b2b3 g8f6
293281:info depth 5 time 282 nodes 7447 nps 27041
293281:info depth 6

Etc. etc., I'm sure you get the idea.

Regards,
Martin Brown


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scid 3.6.25 (chess database, playing and training application) Pascal rec.games.chess.computer (Computer Chess) 0 September 4th 08 07:40 AM
The cheating IBM Wlodzimierz Holsztynski (Wlod) rec.games.chess.politics (Chess Politics) 148 July 22nd 06 02:52 PM
The cheating IBM Chess One rec.games.chess.misc (Chess General) 120 July 22nd 06 02:52 PM
The cheating IBM Chess One rec.games.chess.computer (Computer Chess) 100 July 22nd 06 02:52 PM


All times are GMT +1. The time now is 07:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.Content Relevant URLs by vBSEO 2.4.0
Copyright ©2004-2010 ChessBanter.
The comments are property of their posters.