Ponder
Moderators: hgm, Rebel, chrisw
-
- Posts: 226
- Joined: Sun Mar 08, 2009 3:08 pm
- Location: Canada
Re: Ponder
Yeah, I guess I'll need to figure out: Post_Stat_Thinking() to get it to have any visible output to see if this works or not. Something simpler, or a simplified version of this would be great. Maybe I could use somthing other that post_stat_thinking. Im surprised this compiled without more errors, somthing cant be right, but I dont have a way to test it yet.
outAtime
-
- Posts: 226
- Joined: Sun Mar 08, 2009 3:08 pm
- Location: Canada
Re: Ponder
And I'll also have to tell it to think() when its time to ponder...hehe, that will prolly help. Yeah, its not the simplest solution I was hoping for, but Im learning somthing at least.
outAtime
-
- Posts: 1243
- Joined: Sat Dec 13, 2008 7:00 pm
Re: Ponder
If we're nitpicking: 6 doesn't follow from 5 but 7 does.Sven Schüle wrote: 5) It combines several purposes in one function, while I think it would be better to separate the pure detection of input being available from processing that input.
6) As an implication of 5), it works with engines based on the WB protocol only.
7) It depends on several global variables and constants (read_fds, timeout, xb_mode, is_pondering, Variant, Bughouse, Crazyhouse) and also calls at least one engine-specific function (post_stat_thinking()) so it is not easy to port it to a different engine.
Sven
The code in Sjeng-Free is not a good example of how to implement pondering. That is clear.
I also don't think there is a "very easy" way to implement pondering on a move in WinBoard (rather than just thinking on the opponents time).
-
- Posts: 226
- Joined: Sun Mar 08, 2009 3:08 pm
- Location: Canada
Re: Ponder
Well, I just don't know how else to go about it really. Im leaving out the edit mode stuff. Will I need (is_analyzing) for this I wonder?
outAtime
-
- Posts: 226
- Joined: Sun Mar 08, 2009 3:08 pm
- Location: Canada
Re: Ponder
Code: Select all
/* get our input: */
if (!xb_mode) {
if (show_board && strcmp (input, "help")) {
printf ("\n");
display_board (stdout, 1-comp_color);
}
printf (" > ");
rinput (input, STR_BUFF, stdin);
}
else {
/* start pondering */
if ((allow_pondering && !force_mode) || is_analyzing ))
{
is_pondering = TRUE;
think();
is_pondering = FALSE;
}
rinput (input, STR_BUFF, stdin);
}
Just wondered if I need is_analyzing here...or maybe there is a substitute, Im just not sure how it operates here.
outAtime
-
- Posts: 226
- Joined: Sun Mar 08, 2009 3:08 pm
- Location: Canada
Re: Ponder
hmm..ok, looks like that is another feature, maybe I can add later or somthing. Dosen't look like I will need to use it for this (thankfully)
outAtime
-
- Posts: 27811
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Ponder
Why would that be more difficult? Just make the move before you start pondering, and unmake it after you are done:Gian-Carlo Pascutto wrote:I also don't think there is a "very easy" way to implement pondering on a move in WinBoard (rather than just thinking on the opponents time).
Code: Select all
// WB command loop:
while(1) {
if(stm == computer) {
Search();
abort = 0;
bestMove = PV[0];
ponderMove = PV[1];
MakeMove(bestMove);
PrintMove(bestMove);
}
if(ponderOn) {
if(ponderMove) {
MakeMove(ponderMove);
Search();
UnMake();
} else Search();
}
abort = 0;
ReadLine(inbuf);
// execute command
....
}
-
- Posts: 1243
- Joined: Sat Dec 13, 2008 7:00 pm
Re: Ponder
Because your action will be different depending on the move you receive as input.hgm wrote:Why would that be more difficult? Just make the move before you start pondering, and unmake it after you are done:Gian-Carlo Pascutto wrote:I also don't think there is a "very easy" way to implement pondering on a move in WinBoard (rather than just thinking on the opponents time).
If you receive the move you made at the root, you want to start your clock and continue the search.
If you receive a different move, you want to stop ASAP.
Last edited by Gian-Carlo Pascutto on Tue Mar 02, 2010 6:31 pm, edited 1 time in total.
-
- Posts: 226
- Joined: Sun Mar 08, 2009 3:08 pm
- Location: Canada
Re: Ponder
Im just trying to figure out how to make it output, I think Ive covered the rest of the bases, just dont know how I can use post_stat_thinking();
maybe I can use something else, whatever outputs the lines while the engine has the move.
Code: Select all
else if (c == '.') /* Stat request */
{
getc(stdin);
post_stat_thinking();
return 0;
}
ungetc(c, stdin);
if (!is_pondering && (Variant == Bughouse || Variant == Crazyhouse)) return 0;
return 1;
outAtime
-
- Posts: 27811
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Ponder
Well, that depends on your time management strategy. On a hit you could subtract the opponent time from your target time, on a miss you wouldn't. (When not pondering on a move, I subtract 30% of the ponder time.) That does not seem such a big difference.Gian-Carlo Pascutto wrote:If you receive the move you made at the root, you want to start your clock and continue the search.
If you receive a different move, you want to stop ASAP.
Code: Select all
// WB command loop:
while(1) {
if(stm == computer) {
Search(TARGET_TIME - ponderTime);
abort = 0;
bestMove = PV[0];
ponderMove = PV[1];
MakeMove(bestMove);
PrintMove(bestMove);
}
ponderTime = 0;
if(ponderOn) {
start = clock();
if(ponderMove) {
MakeMove(ponderMove);
Search(INFINITE);
UnMake();
} else Search(INFINITE);
ponderTime = clock() - start;
}
abort = 0;
ReadLine(inbuf);
// execute command
....
// user-move
{
MakeMove(move);
if(move != ponderMove && ponderOn) {
if(ponderMove) ponderTime = 0; else ponderTime *= 0.3;
}
continue;
}
}