hi, I'm having some trouble understanding the uci ponder protocol.
I understood the engine should send the ponder option in reply to to the uci command to inform the gui, but i didn't understood what to expect next.
is this a good command sequence?
>uci
<uciok
< option ponder ......
>position startpos
>go wtime 4000 btime 40000
<bestmove e2e4 ponder d7d5
>position startpos moves e2e4 d7d5
what now??
>go ponder wtime 3900 btime 4000
the engine start pondering/(infinite search)
now two options
>stop (the engine stop and wait for a new position)
>ponderhit ( the engine switch to a normal search and start to count the time
am i wrong?
uci ponder protocol
Moderators: hgm, Rebel, chrisw
-
- Posts: 1221
- Joined: Wed Mar 08, 2006 8:28 pm
- Location: Florida, USA
Re: uci ponder protocol
You're basically right.
Here's what Maverick does:
When it gets a command such as:
"go ponder wtime 3900 btime 4000"
Maverick calculates the time it would normally spend thinking if it wasn't pondering (TargetTime) and an abort time (i.e. time to interrupt the search). It then starts to "think". The only difference is with the Ponder flag set it ignores the time and continues searching. If it gets a "ponder hit" then it sets the ponder flag to false and (in the search) sees if it's past the abort time (in which case it moves) or continues searching (without the ponder flag set).
It works well
Steve
Here's what Maverick does:
When it gets a command such as:
"go ponder wtime 3900 btime 4000"
Maverick calculates the time it would normally spend thinking if it wasn't pondering (TargetTime) and an abort time (i.e. time to interrupt the search). It then starts to "think". The only difference is with the Ponder flag set it ignores the time and continues searching. If it gets a "ponder hit" then it sets the ponder flag to false and (in the search) sees if it's past the abort time (in which case it moves) or continues searching (without the ponder flag set).
It works well
Steve
http://www.chessprogramming.net - Maverick Chess Engine
-
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: uci ponder protocol
According to the specs it looks as if you should send "option name Ponder ..." prior to sending "uciok".elcabesa wrote:hi, I'm having some trouble understanding the uci ponder protocol.
I understood the engine should send the ponder option in reply to to the uci command to inform the gui, but i didn't understood what to expect next.
is this a good command sequence?
>uci
<uciok
< option ponder ......
>position startpos
>go wtime 4000 btime 40000
<bestmove e2e4 ponder d7d5
>position startpos moves e2e4 d7d5
what now??
>go ponder wtime 3900 btime 4000
the engine start pondering/(infinite search)
now two options
>stop (the engine stop and wait for a new position)
>ponderhit ( the engine switch to a normal search and start to count the time
am i wrong?
Note that you need to reply to "stop" with "bestmove ...". One "bestmove" per "go".
Code: Select all
>uci
<id name MyEngine
<id author Marco Belli
<option name Ponder type check ...
<uciok
>ucinewgame
>isready
[engine initializes new game]
<readyok
>position startpos
>go wtime 4000 btime 4000
[engine starts normal search]
<bestmove e2e4 ponder d7d5
>position startpos moves e2e4 d7d5
[what now?? => engine sets up initial position and makes the given moves]
>go ponder wtime 3900 btime 4000
[engine starts searching in ponder mode]
>ponderhit
[opponent has played the ponder move, engine switches to normal search]
<bestmove e4d5 ponder d8d5
>position startpos moves e2e4 d7d5 e4d5 d8d5
[what now?? => engine sets up initial position and makes the given moves]
>go ponder wtime 3800 btime 3900
[engine starts searching in ponder mode]
>stop
[opponent has played a different move, engine stops search and sends back some bestmove command just for the protocol]
<bestmove b1c3
[GUI ignores the engine's response since it belongs to the ponder move which has not been played]
>position startpos moves e2e4 d7d5 e4d5 g8f6
[what now?? => engine sets up initial position and makes the given moves]
>go wtime 3700 btime 3800
[engine starts normal search]
<bestmove b1c3 ponder f6d5
>... and so on
Sven
-
- Posts: 855
- Joined: Sun May 23, 2010 1:32 pm
Re: uci ponder protocol
thank you, simpler than I first tough.
I'll implement this asap
I'll implement this asap
-
- Posts: 27808
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: uci ponder protocol
Note that in the strict interpretation of the protocol, a GUI should not set an engine pondering if it does not support the Ponder option (i.e. does not send 'option name Ponder type check ...' in response to 'uci'. Some engines sin against this (i.e. they would be able to ponder if requested to do so, but do not announce the Ponder option.) Polyglot has a work-around setting for this ('Polyglot CanPonder'), which forces the GUI (i.e. Polyglot) to emit ponder commands despite the absence of a Ponder option.
The idea of the Ponder option is that the engine can calculate the target time per move differently if it knows that it will be allowed to ponder, taking more generous time, because it can count on earning some time back by ponder hits during the rest of the game.
The idea of the Ponder option is that the engine can calculate the target time per move differently if it knows that it will be allowed to ponder, taking more generous time, because it can count on earning some time back by ponder hits during the rest of the game.
-
- Posts: 855
- Joined: Sun May 23, 2010 1:32 pm
Re: uci ponder protocol
I think I have implemented the code, but how to test it? i'm using cutechess-cli and it doesn't support ponder, any other free alternative?
-
- Posts: 70
- Joined: Thu Jul 12, 2012 12:43 am
- Location: Turin, Italy
Re: uci ponder protocol
winboard, arena...