Regarding options ponder flag

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: Regarding options ponder flag

Post by hgm »

Engines might want to use more time per move if they know they are playing in a ponder game, counting on ponder hits to give them extra time for the moves still to come. The Ponder option allows them to do that. UCI engines are not supposed to remember anything of any previous position-moves or go command. But they can remember their option settings. So if the get a "go movestogo 10 wtime xxx ..." they should consult the Ponder setting to know how much of the xxx to use for this move.

Unlike what is stated above, UCI engines should prit a bestmove when they are stopped after 'go infinite'. Note that 'go infinite' does nNOT necessarily mean the engine is analysing. It is perfectly valid for a GUI to implement a match mode where it decides itself how long to make the engine think, sending 'stop' if it thinks the engie has thought long enough. If an engine wants to know whether it is analyzing, it should look at the setting of the UCI_AnalyseMode option.
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 »

Thanks marco, hgm!

forgive me ... i sum it up (as far i understood now) - dump J ;-)

- if engine doesnt have this ponder flag, i disallow to enter the brain (ponder on opp time) mode. Whereas its perfectly ok, to let the engine doing a infinite search (=analysis).

- if user enters this brain mode i should send "ponder=true" before "go" or "false" if normal search/play or analysis.

- if user enters analysis mode, i send "UCI_AnalyseMode" if this flag is valid for the engine (ok, i can just send - should be ignored if invalid).
Create a dedicated chess computer based on tiny ARM computers with the DGT e-board on picochess.com
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Regarding options ponder flag

Post by hgm »

Well, I think you should leave Ponder set for the entire game if it is a ponder game. Also during commands other than 'go ponder'. It informs the engine of whether future moves can be expected to use extra time over what is now on the clock, because they get ponder hits.

Worst defect of UCI is that there is o way to know whether the egine supports 'searchmoves' with the 'go' command.
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?