UCI question - limiting search depth

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UCI question - limiting search depth

Post by hgm »

The new version has more piece types, and when you load external pixmaps, you would also have to supply pixmaps for those.

This should not be a fatal error, btw, just a warning that your set of pixmaps is incomplete. As long as you don't use the piece for wich the pixmap was missing, there are no consequences.

To change the colors does not require loading of pixmaps, though. There are separate arguments to control the square and piece colors of the built-in bitmaps.

But that as an aside. Now back to the main problem. Can you post the Polyglot log of a short game (first two moves, say) to show us what Polyglot sends to the engine? It seems to be a Polyglot bug.
royb
Posts: 566
Joined: Thu Mar 09, 2006 12:53 am

Re: UCI question - limiting search depth

Post by royb »

hgm wrote:The new version has more piece types, and when you load external pixmaps, you would also have to supply pixmaps for those.

This should not be a fatal error, btw, just a warning that your set of pixmaps is incomplete. As long as you don't use the piece for wich the pixmap was missing, there are no consequences.

To change the colors does not require loading of pixmaps, though. There are separate arguments to control the square and piece colors of the built-in bitmaps.

But that as an aside. Now back to the main problem. Can you post the Polyglot log of a short game (first two moves, say) to show us what Polyglot sends to the engine? It seems to be a Polyglot bug.
Actually, the error on the pixmap is fatal. Xboard crashes/exits after that message appears.

Here is the polyglot log for the white side. I tried to set maxdepth to 2 ply both in the polyglot.ini file (and I am unsure of the syntax for that but there is a spot where the log mentions depth 2):

I post the beginning of the file and then again (later on in the game) after the opening book has ended to show that Fruit calculates many more than 2 ply ...

1251506605.094 PolyGlot 1.4.39b by Fabien Letouzey
1251506605.094 POLYGLOT *** START ***
1251506605.094 POLYGLOT INI file "/home/roy/chess/fruit-2.3.1/linux/polyglot-a.ini"
1251506605.094 POLYGLOT [PolyGlot] EngineDir=/home/roy/chess/fruit-2.3.1/linux
1251506605.094 POLYGLOT [PolyGlot] EngineCommand=./Fruit-2-3-1-Linux
1251506605.094 POLYGLOT [PolyGlot] depth=2
1251506605.094 POLYGLOT [PolyGlot] Log=true
1251506605.094 POLYGLOT [PolyGlot] LogFile=Fruit-2-3-1-2ply.log
1251506605.094 POLYGLOT [PolyGlot] Resign=true
1251506605.094 POLYGLOT [PolyGlot] ResignScore=600
1251506605.094 POLYGLOT [Engine] Hash=128
1251506605.094 POLYGLOT [Engine] NalimovPath=/home/roy/chess/TBs
1251506605.094 POLYGLOT [Engine] NalimovCache=32
1251506605.094 POLYGLOT [Engine] Ponder=false
1251506605.094 POLYGLOT [Engine] OwnBook=true
1251506605.094 POLYGLOT [Engine] BookFile=performance.bin
1251506605.094 POLYGLOT [Engine] EGTB=true
1251506605.094 POLYGLOT [Engine] Play Style=Semi-Aggressive
1251506605.094 POLYGLOT [Engine] depth=2
1251506605.097 Adapter->Engine: uci
<snip>
1251506605.098 Engine->Adapter: uciok
1251506605.098 Adapter->Engine: setoption name Hash value 128
1251506605.099 Adapter->Engine: setoption name NalimovPath value /home/roy/chess/TBs
1251506605.099 Adapter->Engine: setoption name NalimovCache value 32
1251506605.099 POLYGLOT Not sending option "Ponder" since it already has the correct value.
1251506605.099 POLYGLOT Not sending option "OwnBook" since it already has the correct value.
1251506605.099 Adapter->Engine: setoption name BookFile value performance.bin
1251506605.099 POLYGLOT Not sending option "EGTB" since it already has the correct value.
1251506605.099 Adapter->Engine: setoption name Play Style value Semi-Aggressive
1251506605.099 GUI->Adapter: xboard
1251506605.099 GUI->Adapter: protover 2
1251506605.099 Adapter->GUI: feature done=0
1251506605.099 Adapter->GUI: feature analyze=1
1251506605.099 Adapter->GUI: feature colors=0
1251506605.099 Adapter->GUI: feature draw=1
1251506605.099 Adapter->GUI: feature ics=1
1251506605.099 Adapter->GUI: feature myname="Fruit 2.3.1"
1251506605.099 Adapter->GUI: feature name=1
1251506605.099 Adapter->GUI: feature pause=0
1251506605.099 Adapter->GUI: feature ping=1
1251506605.099 Adapter->GUI: feature playother=1
1251506605.099 Adapter->GUI: feature reuse=1
1251506605.099 Adapter->GUI: feature san=0
1251506605.099 Adapter->GUI: feature setboard=1
1251506605.099 Adapter->GUI: feature sigint=0
1251506605.099 Adapter->GUI: feature sigterm=0
1251506605.099 Adapter->GUI: feature time=1
1251506605.099 Adapter->GUI: feature usermove=1
1251506605.099 Adapter->GUI: feature memory=1
1251506605.099 Adapter->GUI: feature smp=0
1251506605.099 Adapter->GUI: feature egt="nalimov"
1251506605.099 Adapter->GUI: feature variants="normal,fischerandom"
1251506605.099 Adapter->GUI: feature option="NalimovCache -spin 32 1 512"
1251506605.099 Adapter->GUI: feature option="EGBB Path -string egbb"
1251506605.099 Adapter->GUI: feature option="EGBB Cache -spin 16 16 512"
1251506605.099 Adapter->GUI: feature option="OwnBook -check 1"
1251506605.099 Adapter->GUI: feature option="MultiPV -spin 1 1 256"
1251506605.099 Adapter->GUI: feature option="UCI_EngineAbout -string Fruit by Fabien Letouzey, see http://www.fruitchess.com/"
1251506605.099 Adapter->GUI: feature option="BookFile -string performance.bin"
1251506605.099 Adapter->GUI: feature option="Time Allocation -spin 100 0 400"
1251506605.099 Adapter->GUI: feature option="EGTB -check 1"
1251506605.099 Adapter->GUI: feature option="Verification Search -combo *Always /// Endgame /// Never"
1251506605.099 Adapter->GUI: feature option="Quiescence Checks -spin 1 1 2"
1251506605.099 Adapter->GUI: feature option="Quiescence Checks PV -spin 2 1 4"
1251506605.099 Adapter->GUI: feature option="Pruning -combo *Normal /// Aggressive"
1251506605.100 Adapter->GUI: feature option="Use Aspiration search -check 0"
1251506605.100 Adapter->GUI: feature option="Use Fast Eval -check 1"
1251506605.100 Adapter->GUI: feature option="PPExt -check 0"
1251506605.100 Adapter->GUI: feature option="Extend Checks -check 0"
1251506605.100 Adapter->GUI: feature option="Use Search Focus -check 1"
1251506605.100 Adapter->GUI: feature option="Focus Depth -spin 1 0 4"
1251506605.100 Adapter->GUI: feature option="Search Focus Ext -check 0"
1251506605.100 Adapter->GUI: feature option="Round Eval -check 0"
<snip>
1251506605.102 GUI->Adapter: accepted done
1251506605.102 GUI->Adapter: accepted analyze
1251506605.102 GUI->Adapter: accepted colors
1251506605.102 GUI->Adapter: accepted draw
1251506605.102 GUI->Adapter: accepted ics
1251506605.102 GUI->Adapter: accepted myname
1251506605.102 GUI->Adapter: accepted name
1251506605.102 GUI->Adapter: accepted pause
1251506605.102 GUI->Adapter: accepted ping
1251506605.102 GUI->Adapter: accepted playother
1251506605.102 GUI->Adapter: accepted reuse
1251506605.102 GUI->Adapter: accepted san
1251506605.102 GUI->Adapter: accepted setboard
1251506605.102 GUI->Adapter: accepted sigint
1251506605.102 GUI->Adapter: accepted sigterm
1251506605.102 GUI->Adapter: accepted time
1251506605.102 GUI->Adapter: accepted usermove
1251506605.102 GUI->Adapter: rejected memory
1251506605.102 GUI->Adapter: rejected smp
1251506605.102 GUI->Adapter: rejected egt
1251506605.102 GUI->Adapter: accepted variants
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
1251506605.102 GUI->Adapter: rejected option
<snip>
1251506605.103 GUI->Adapter: new^Nsd 2^Nrandom^Nics -
1251506605.103 Adapter->GUI: Error (unknown command): new^Nsd 2^Nrandom^Nics -
1251506605.103 GUI->Adapter: level 40 5 0
1251506605.103 GUI->Adapter: hard
1251506605.103 POLYGLOT WAIT
1251506605.103 GUI->Adapter: easy
1251506605.103 POLYGLOT WAIT
1251506605.103 GUI->Adapter: ping 1
1251506605.103 Adapter->GUI: pong 1
1251506605.103 GUI->Adapter: force
1251506605.103 POLYGLOT WAIT
1251506605.121 GUI->Adapter: computer
1251506605.121 GUI->Adapter: name Fruit 2.3.1
1251506605.121 GUI->Adapter: time 30000
1251506605.121 GUI->Adapter: otim 30000
1251506605.121 GUI->Adapter: go
1251506605.121 POLYGLOT THINK
1251506605.121 POLYGLOT START SEARCH
1251506605.121 POLYGLOT Not sending option "UCI_Chess960" since it already has the correct value.
1251506605.121 POLYGLOT Not sending option "Ponder" since it already has the correct value.
1251506605.121 POLYGLOT FEN rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
1251506605.121 Adapter->Engine: position startpos
1251506605.122 Adapter->Engine: go wtime 300000 btime 300000 movestogo 40
1251506605.280 Engine->Adapter: info depth 1 score cp 1 time 0 nodes 0 pv d2d4 g8f6
1251506605.280 Engine->Adapter: info time 0 nodes 0 nps 0 tbhits 0 cpuload 0
1251506605.280 Engine->Adapter: info hashfull 0
1251506605.280 Engine->Adapter: bestmove d2d4 ponder g8f6
1251506605.280 Adapter->GUI: move d2d4
1251506605.280 POLYGLOT MOVE d4
1251506605.280 POLYGLOT THINK -> WAIT
1251506605.435 GUI->Adapter: time 30000
1251506605.435 GUI->Adapter: otim 30000
1251506605.435 GUI->Adapter: usermove g8f6
<snip>
1251506620.183 Adapter->Engine: position startpos moves d2d4 g8f6 c2c4 e7e6 g1f3 d7d5
b1c3 f8e7 c1g5 h7h6 g5h4 e8g8 e2e3 b7b6 f1e2 c8b7 a1c1 d5c4 e1g1 g7g5
1251506620.183 Adapter->Engine: go wtime 300000 btime 300000 movestogo 30
1251506620.267 Engine->Adapter: info depth 1
1251506620.267 Engine->Adapter: info multipv 1 depth 1 score cp 39 time 2 nodes 1796
pv h4g3 g5g4
1251506620.267 Engine->Adapter: info depth 1 time 2 nodes 1887 nps 0 tbhits 0
1251506620.267 Engine->Adapter: info depth 2
1251506620.267 Engine->Adapter: info multipv 1 depth 2 score cp 31 time 2 nodes 2187 pv h4g3 g5g4 f3e5
1251506620.267 Engine->Adapter: info depth 2 time 3 nodes 2257 nps 0 tbhits 0
1251506620.267 Engine->Adapter: info depth 3
1251506620.267 Engine->Adapter: info multipv 1 depth 3 score cp 56 time 4 nodes 3277 pv h4g3 f6h5 e2c4 h5g3 f2g3
1251506620.267 Engine->Adapter: info depth 3 time 4 nodes 3454 nps 0 tbhits 0
1251506620.267 Engine->Adapter: info depth 4
1251506620.267 Engine->Adapter: info multipv 1 depth 4 score cp 56 time 5 nodes 3972 pv h4g3 f6h5 e2c4 h5g3 f2g3

and it goes on and on to depth 12 ...

I hope the <snips> did not exclude anything important.

In my polyglot.ini file I include "depth = 2" in the Polyglot section and again in the engine section because it is not clear from anything I can find via google what the right syntax is (and which section to place it in).

Thanks for your assistance with this!

Roy
User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UCI question - limiting search depth

Post by hgm »

Something goes wrong in the InitString:

Code: Select all

1251506605.103 GUI->Adapter: new^Nsd 2^Nrandom^Nics - 
1251506605.103 Adapter->GUI: Error (unknown command): new^Nsd 2^Nrandom^Nics - 
^N is not the usual notation for a linefeed, (usually it is used to denote Ctrl-N) and indeed Polyglot does not see any linefeeds, but considers the whole InitString as a single command, which it then of course does not recognize. So none of the commands in the Initstring are in fact recognized, so it is not strange that the sd 2 is ignored. It is in fact a small miracle that Polyglot is able to play a game at all, without receiving a 'new' command!

What happens if you write \012 in stead of \n in the InitString, or \\n ? Or do not put quotes around the string? It seems that either XBoard messes up the InitString before passing it to Polyglot, or the shell already messes up the InitString before it passes it to XBoard. Somehow the linefeeds are replaced by something else by the time the InitString reaches Polyglot.
royb
Posts: 566
Joined: Thu Mar 09, 2006 12:53 am

Re: UCI question - limiting search depth

Post by royb »

hgm wrote:Something goes wrong in the InitString:

Code: Select all

1251506605.103 GUI->Adapter: new^Nsd 2^Nrandom^Nics - 
1251506605.103 Adapter->GUI: Error (unknown command): new^Nsd 2^Nrandom^Nics - 
^N is not the usual notation for a linefeed, (usually it is used to denote Ctrl-N) and indeed Polyglot does not see any linefeeds, but considers the whole InitString as a single command, which it then of course does not recognize. So none of the commands in the Initstring are in fact recognized, so it is not strange that the sd 2 is ignored. It is in fact a small miracle that Polyglot is able to play a game at all, without receiving a 'new' command!

What happens if you write \012 in stead of \n in the InitString, or \\n ? Or do not put quotes around the string? It seems that either XBoard messes up the InitString before passing it to Polyglot, or the shell already messes up the InitString before it passes it to XBoard. Somehow the linefeeds are replaced by something else by the time the InitString reaches Polyglot.
I was told earlier that Ctrl-N was needed (newline) between commands on the initString. Is that not so? Anyway, I substituted \012 and that made no difference.

The quotes are needed since "sd 2" has a space in it and that causes a syntax error without them.

The whole thing is much too difficult to set up. Embedding a control inside the polyglot.ini file seems the best way to do this to me, but from what I can tell, that is not supported either.

Roy
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: UCI question - limiting search depth

Post by Zach Wegner »

Ctrl-J is a linefeed, Ctrl-M is a carriage return. Anyways, you just need a \n in the string.

And I will have to agree that using the init string is a very ridiculous way for something to work. Perhaps useful as a work-around for buggy engines in exceptional circumstances, normal users should never have to do such things...
User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UCI question - limiting search depth

Post by hgm »

royb wrote:The quotes are needed since "sd 2" has a space in it and that causes a syntax error without them.
Ah, of course.

Well, it seems we encounter multiple problems here. One is a bad XBoard bug: the InitString options do not work correctly there at all. When you write

-xboard -firstInitString "new\nrandom\n"

it does not send linefeeds to the engine after new and random. It sends backslashes and n characters! This of course makes the whole thing one (unrecognized) command to the engine. So the InitString in XBoard (unlike WinBoard) is really sent litterally as it was typed between the quotes. (And strings without quoting, even if they don't contain spaces, would see the backslash removed by the shell, but the n would still be sent.) This makes the InitString unusable in XBoard, as it needs to contain linefeeds, and I know of no way to include a linefeed in a shell argument.

Now it should of course still be possible to use XBoard with the -depth argument to trigger sending sd to the engine. (You could not do depth-odds matches, though; both engines would get the same depth.) This works for me:
1251611646.834 GUI->Adapter: accepted done
1251611646.834 GUI->Adapter: memory 68
1251611646.834 POLYGLOT setting the amount of memory to 68Mb
1251611646.834 POLYGLOT Nalimov Cache is 0Mb
1251611646.834 Adapter->Engine: setoption name Hash value 68
1251611646.834 GUI->Adapter: new
1251611646.834 Adapter->Engine: isready
1251611646.834 POLYGLOT NEW GAME
1251611646.835 POLYGLOT WAIT
1251611646.835 Adapter->Engine: ucinewgame
1251611646.835 GUI->Adapter: random
1251611646.835 GUI->Adapter: ics -
1251611646.835 GUI->Adapter: level 40 5 0
1251611646.835 GUI->Adapter: sd 2
1251611646.835 GUI->Adapter: post
1251611646.835 GUI->Adapter: hard
1251611646.835 POLYGLOT WAIT
1251611646.835 GUI->Adapter: ping 1
1251611646.835 Adapter->GUI: pong 1
1251611647.080 Engine->Adapter: readyok
1251611650.430 GUI->Adapter: name hgm
1251611650.431 GUI->Adapter: time 30000
1251611650.431 GUI->Adapter: otim 30000
1251611650.431 GUI->Adapter: usermove e2e4
1251611650.431 POLYGLOT MOVE e4
1251611650.431 POLYGLOT WAIT -> THINK
1251611650.431 POLYGLOT START SEARCH
1251611650.431 Adapter->Engine: setoption name Ponder value true
1251611650.431 POLYGLOT FEN rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1
1251611650.431 Adapter->Engine: position startpos moves e2e4
1251611650.431 Adapter->Engine: go wtime 300000 btime 300000 movestogo 40 depth 2
1251611650.432 Engine->Adapter: info depth 1
1251611650.433 Engine->Adapter: info depth 1 seldepth 1 score cp -40 time 0 nodes 2 pv a7a5
1251611650.433 Adapter->GUI: 1 -40 0 2 a5
1251611650.433 Engine->Adapter: info depth 1 seldepth 2 score cp -34 time 0 nodes 6 pv b7b6
1251611650.433 Adapter->GUI: 1 -34 0 6 b6
1251611650.433 Engine->Adapter: info depth 1 seldepth 7 score cp 8 time 0 nodes 42 pv d7d5
1251611650.433 Adapter->GUI: 1 +8 0 42 d5
1251611650.433 Engine->Adapter: info depth 1 seldepth 7 score cp 10 time 0 nodes 77 pv b8c6
1251611650.433 Adapter->GUI: 1 +10 0 77 Nc6
1251611650.433 Engine->Adapter: info depth 1 seldepth 7 time 0 nodes 79 nps 0
1251611650.433 Engine->Adapter: info depth 2
1251611650.433 Engine->Adapter: info depth 2 seldepth 7 score cp -44 time 1 nodes 120 pv b8c6 b1c3
1251611650.433 Adapter->GUI: 2 -44 0 120 Nc6 Nc3
1251611650.433 Engine->Adapter: info depth 2 seldepth 7 time 1 nodes 164 nps 0
1251611650.433 Engine->Adapter: info time 1 nodes 164 nps 0 cpuload 0
1251611650.433 Engine->Adapter: info hashfull 0
1251611650.433 Engine->Adapter: bestmove b8c6 ponder b1c3
1251611650.433 Adapter->GUI: 2 -44 0 164 Nc6 Nc3
1251611650.433 Adapter->GUI: move b8c6
1251611650.433 POLYGLOT MOVE Nc6
1251611650.433 POLYGLOT THINK -> PONDER
Polyglot indeed sends a "depth" qualifier with the UCI "go" command, and the engine (Fruit 2.1) does respond to that, producing a move after only 2 ply.

Thanks for spotting this. I will fix the problem in XBoard, by not sending the bare InitString, but first using it as the format in an sprintf to translate any escape sequences in it.
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: UCI question - limiting search depth

Post by Zach Wegner »

hgm wrote:This makes the InitString unusable in XBoard, as it needs to contain linefeeds, and I know of no way to include a linefeed in a shell argument.
It's pretty simple--just include a linefeed. :)
Thanks for spotting this. I will fix the problem in XBoard, by not sending the bare InitString, but first using it as the format in an sprintf to translate any escape sequences in it.
That's a bad idea, since format specifiers (%s etc.) in the init string will usually cause a crash. A simple routine to replace \ns with newlines should suffice.
User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UCI question - limiting search depth

Post by hgm »

It was an even more stupid idea than you though, because of course printf does not expand \n at all. It expands %x stuff. It was the compiler that expanded the \n already in the format string.

I wrote the routine as you suggest, and now it works. Also suppressed the fatal error on missing pixmaps for unorthodox pieces, and have it substitute King to prevent later crashes.

I don't understand your remark: just include the linefeed. As soon as I type linefeed on a command line it terminates the line. If I preceed it by \ it ignores the linefeed. So which trick am I missing?

Anyway, new XBoard is at http://home.hccnet.nl/h.g.muller/xboard ... 2_i386.deb .
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: UCI question - limiting search depth

Post by Zach Wegner »

hgm wrote:I don't understand your remark: just include the linefeed. As soon as I type linefeed on a command line it terminates the line. If I preceed it by \ it ignores the linefeed. So which trick am I missing?
It has to be inside quotes, then the shell will use the secondary prompt to make you finish the line. I had assumed it would already be in quotes.
User avatar
hgm
Posts: 28387
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UCI question - limiting search depth

Post by hgm »

I did try that, but it did not work. :? The linefeeds disappeared altogether from the InitString. It might not be the shell's fault, though; perhaps the X-toolkit argument processing does remove the linefeeds.

Anyway, it now works as specified in the manual (and the same as in WinBoard). But only for InitString and ComputerString arguments.