Regarding options ponder flag

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: Regarding options ponder flag

Post by elcabesa »

as stated by hgm, simply send option ponder befor the start of the game, not before every go command :)
LocutusOfPenguin
Posts: 34
Joined: Thu Sep 28, 2017 6:52 pm
Location: Karlsruhe, Germany
Full name: Jürgen Précour

Re: Regarding options ponder flag

Post by LocutusOfPenguin »

indeed.
i only put engines inside which supports all features of picochess incl. "alternative move" => searchmoves needed.
My beloved chess engine dev's are sometimes abit "behind" :roll: on implementing all uci features.

OK, now i know how to deal with this flag. Thanks again.
(forbit analysis on a non-ponder-flag engine was too hard - my problem)
Create a dedicated chess computer based on tiny ARM computers with the DGT e-board on picochess.com
Ras
Posts: 2488
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Regarding options ponder flag

Post by Ras »

elcabesa wrote:Go infinite and go ponder are for different feature, but probably have similar result.
There is an important difference. From the UCI spec concerning the ponder move:
However, if the engine decides to ponder on a different move, it should not display any mainlines as they are likely to be misinterpreted by the GUI because the GUI expects the engine to ponder on the suggested move.
Consequence: using ponder for analysis runs the risk of suddenly not getting PVs anymore. Therefore, ponder should not be used for analysis.
Ras
Posts: 2488
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Regarding options ponder flag

Post by Ras »

hgm wrote:Worst defect of UCI is that there is o way to know whether the egine supports 'searchmoves' with the 'go' command.
This isn't a UCI defect, but an engine defect because 'searchmoves' is not optional with UCI, and engines not implementing it are not UCI-conforming. Actually, they are not UCI engines.

For dealing with these engines, there is a workaround how you can determine whether 'searchmoves' is supported: send a position where some moves lead to being mated in 1 and other moves are fine. Then send searchmoves with only the self-mating moves allowed. If the engine returns a best move that is in the 'searchmoves' list, it supports this command, and otherwise, it doesn't.
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Regarding options ponder flag

Post by Fulvio »

LocutusOfPenguin wrote: Analyse im doing with "go infinite" Brain with "go ponder".
When pondering, are you sending 2 "go" for each move, right?

>> setoption name Ponder value true
>> ucinewgame
>> isready
wait for readyok

>> position startpos moves
>> go movetime 1000

after 1 second the engine replies:
<< bestmove d2d4 ponder d7d5

and immediately the GUI sends:
>> position startpos moves d2d4 d7d5
>> go ponder

When the user moves:
>> stop
wait for bestmove

>> ponderhit (if the user played the ponder move) or position
>> go movetime 1000
etc...
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: Regarding options ponder flag

Post by elcabesa »

Fulvio wrote:
LocutusOfPenguin wrote: Analyse im doing with "go infinite" Brain with "go ponder".
When pondering, are you sending 2 "go" for each move, right?

>> setoption name Ponder value true
>> ucinewgame
>> isready
wait for readyok

>> position startpos moves
>> go movetime 1000

after 1 second the engine replies:
<< bestmove d2d4 ponder d7d5

and immediately the GUI sends:
>> position startpos moves d2d4 d7d5
>> go ponder

When the user moves:
>> stop
wait for bestmove

>> ponderhit (if the user played the ponder move) or position
>> go movetime 1000
etc...
NO, it doesn't work this way :)

it work in the following way:
< messages from gui to engine
> messages from engine to gui
# my comments
# the game start and the gui ask the engineA to "go"
< position startpos moves e2e4 e7e5
< go wtime 50000 btime 50000

# the engineA start searching and printing his information, then after some time it print his best move and stop thinking:
> bestmove g1f3 ponder b8c6

#the gui make the engineB start thinking, and tell the engineA to ponder
< position startpos moves e2e4 e7e5 g1f3 b8c6
< go wtime 49900 btime 48700 ponder

# the engineA start poindering on the position specificed by the gui and print info about his search..
# now there are 2 possibility
# case A: the engineB play b8c6 by printing bestmove b8c6
# the gui send to the engine a the following comand:

< ponderhit

# now the engine know that he has searched the right move and he continue his search in a standard way, stopping when he want.
# the engineA eventually stop thinking and print his bestmove
> bestmove f1c4 ponder g8f6

# case b: the engineB play another move ,let's say it play g8f6
# in this case the gui send the stop command to the engine, which should not send his bestmove, setup the new position and send the go command
< stop
< position startpos moves e2e4 e7e5 g1f3 g8f6
< go wtime 49900 btimer 45000
# the engineA start the new search after a pondermiss
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Regarding options ponder flag

Post by Fulvio »

elcabesa wrote: < position startpos moves e2e4 e7e5 g1f3 b8c6
< go wtime 49900 btime 48700 ponder
< ponderhit

< stop
< position startpos moves e2e4 e7e5 g1f3 g8f6
< go wtime 49900 btimer 45000
So your thesis is that in case of a ponderhit the engine do not have the rights to know the correct clock time?
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: Regarding options ponder flag

Post by elcabesa »

Fulvio wrote:
elcabesa wrote: < position startpos moves e2e4 e7e5 g1f3 b8c6
< go wtime 49900 btime 48700 ponder
< ponderhit

< stop
< position startpos moves e2e4 e7e5 g1f3 g8f6
< go wtime 49900 btimer 45000
So your thesis is that in case of a ponderhit the engine do not have the rights to know the correct clock time?
I don't understand your question.
he know his clock time, the gui has alread sent it in the previous go command
go wtime 49900 btime 48700 ponder
the previous go message has the following meaning
  • 1) start pondering
    2) your time on the clock when the black player has finished his search willl be 49900
    3) the time of black player when i sent him the go command is 48700, white doesn't know how much residual time black has when he'll receive ponderhit, but he can estimate it.
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Regarding options ponder flag

Post by Fulvio »

elcabesa wrote: but he can estimate it.
That's exactly my question.
If you are playing a 1 sec x move game on a network do you want him to estimate it?
Why can't we simply tell him the correct time?
Are you trying to penalize him because it guessed the correct move?
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: Regarding options ponder flag

Post by elcabesa »

I don't want to penalize anyone, I'm just explaining the UCI protocol.

I was partially wrong, I read again the UCI protocol specification, and an engine MUST reply with a bestmove after EVERY stop command, even if he was pondering on a wrong move.

this is an example of a game between Vajolet and Ice using Cutechess as GUI.
<vajolet dev(4): bestmove b1d2 ponder b8d7

>ice3-x64(5): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2
>vajolet dev(4): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 b8d7

>vajolet dev(4): go ponder wtime 117286 btime 120000 movestogo 31
>ice3-x64(5): go wtime 117286 btime 120000 movestogo 32

<ice3-x64(5): bestmove h5g6 ponder e1g1
>vajolet dev(4): stop
<vajolet dev(4): bestmove c2c4 ponder f8d6

>ice3-x64(5): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 e1g1
>vajolet dev(4): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6

>vajolet dev(4): go wtime 117286 btime 116287 movestogo 31
>ice3-x64(5): go ponder wtime 117286 btime 116287 movestogo 31

<vajolet dev(4): bestmove f3h4 ponder b8d7
>ice3-x64(5): stop
<ice3-x64(5): bestmove b8d7 ponder f3h4

>vajolet dev(4): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 b8d7
>ice3-x64(5): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4

>vajolet dev(4): go ponder wtime 114246 btime 116287 movestogo 30
>ice3-x64(5): go wtime 114246 btime 116287 movestogo 31

<ice3-x64(5): bestmove f8d6 ponder h4g6
>vajolet dev(4): stop
<vajolet dev(4): bestmove e2e4 ponder d5e4

>ice3-x64(5): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 f8d6 h4g6
>vajolet dev(4): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 f8d6

>vajolet dev(4): go wtime 114246 btime 112655 movestogo 30
>ice3-x64(5): go ponder wtime 114246 btime 112655 movestogo 30

<vajolet dev(4): bestmove e2e4 ponder b8d7
>ice3-x64(5): stop
<ice3-x64(5): bestmove h7g6 ponder e2e3

>vajolet dev(4): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 f8d6 e2e4 b8d7
>ice3-x64(5): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 f8d6 e2e4

>vajolet dev(4): go ponder wtime 110896 btime 112655 movestogo 29
>ice3-x64(5): go wtime 110896 btime 112655 movestogo 30

<ice3-x64(5): bestmove b8d7 ponder e1g1
>vajolet dev(4): ponderhit

>ice3-x64(5): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 f8d6 e2e4 b8d7 e1g1
>ice3-x64(5): go ponder wtime 110896 btime 109628 movestogo 29

<vajolet dev(4): bestmove f2f4 ponder d6c7
>ice3-x64(5): stop
<ice3-x64(5): bestmove e8c8 ponder a1d1

>vajolet dev(4): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 f8d6 e2e4 b8d7 f2f4 d6c7
>ice3-x64(5): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 f8d6 e2e4 b8d7 f2f4

>vajolet dev(4): go ponder wtime 107042 btime 109628 movestogo 28
>ice3-x64(5): go wtime 107042 btime 109628 movestogo 29

<ice3-x64(5): bestmove d5e4 ponder d3e4
>vajolet dev(4): stop
<vajolet dev(4): bestmove h4g6 ponder h7g6

>ice3-x64(5): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 f8d6 e2e4 b8d7 f2f4 d5e4 d3e4
>vajolet dev(4): position startpos moves g1f3 d7d5 g2g3 c7c6 f1g2 g8f6 d2d3 c8g4 h2h3 g4h5 b2b3 e7e6 c1b2 d8a5 d1d2 a5d2 b1d2 h5g6 f3h4 f8d6 e2e4 b8d7 f2f4 d5e4

>vajolet dev(4): go wtime 107042 btime 106354 movestogo 28
>ice3-x64(5): go ponder wtime 107042 btime 106354 movestogo 28