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 »

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
User avatar
hgm
Posts: 27789
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Regarding options ponder flag

Post by hgm »

Fulvio wrote:So your thesis is that in case of a ponderhit the engine do not have the rights to know the correct clock time?
Indeed. This definitely is a design flaw in UCI. You have to send it the opponent's clock time with the go-ponder command, when it is not yet known. (Of course your own time was known then, as your clock is not running during ponder.)

A sensible design would have had the clock times on the 'ponderhit' command.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Regarding options ponder flag

Post by Ras »

hgm wrote:A sensible design would have had the clock times on the 'ponderhit' command.
Taking a look at WB engines: which engine does actually use this piece of information? Especially, does Kingslayer evaluate it? And for what purpose?
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Regarding options ponder flag

Post by Fulvio »

elcabesa wrote:I read again the UCI protocol specification
But... the ponderhit behavior is obviously a bug: why nobody have fixed it?
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Regarding options ponder flag

Post by Fulvio »

Ras wrote: which engine does actually use this piece of information?
I do not understand the logic of this statement. If it is useless why sending it if the pondered move was wrong?
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Regarding options ponder flag

Post by Ras »

Fulvio wrote:If it is useless why sending it if the pondered move was wrong?
Because the go-command just always looks like that?