Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: questions about using fget as waiting loop

Author: Robert Hyatt

Date: 16:52:56 08/30/04

Go up one level in this thread


On August 30, 2004 at 19:18:33, Uri Blass wrote:

>On August 30, 2004 at 18:39:58, Dieter Buerssner wrote:
>
>>On August 30, 2004 at 15:39:45, Robert Hyatt wrote:
>>
>>>On August 30, 2004 at 14:40:25, Uri Blass wrote:
>>>
>>>>/* When using Standard C input functions, also check if there
>>>>is anything in the buffer. After a call to such functions,
>>>>the input waiting in the pipe will be copied to the buffer,
>>>>and the call to PeekNamedPipe can indicate no input available.
>>>>Setting stdin to unbuffered was not enough, IIRC */
>>>>//input_init();
>>>>	if (stdin->_cnt > 0)
>>>>		return 1;
>>>That will not work reliably.  If you run with winboard/xboard long enough it is
>>>guaranteed to hang for the reason I gave.  PeekNamedPipe will not see input that
>>>has already been read by the C library and tucked away in a library buffer.
>>
>>It seems to work very reliably for me. See the above comment in the code (I
>>actually wrote that comment ...).
>>
>>Under Unix, setting stdin to non-buffered  by the Standard C function setvbuf
>>and using select seems to work reliably, too. I read all the input with the
>>Standard C FILE * interface.
>>
>>Regards,
>>Dieter
>
>Yes
>I copied this from you when I asked how to read winboard commands during
>pondering in the winboard forum.
>
>It may be better to add the author of the comments when I add comments by other
>people in the future.
>
>Practically big part of the time  that I use for movei is thinking or writing
>code for technical tasks and I wish to finish with these problems so I can
>release a new version of movei because I do not want to release another buggy
>version.
>
>I have a question for you about checking input during pondering.
>
>Today I check every 8192 nodes and movei is a slow searcher so even on fast
>hardware it is doing it less than 100 times in a second.
>
>I do not like to spend time during pondering because of not getting the time
>command fast enough but if I look very often for winboard commands movei is
>slowed by a significant factor under winboard.
>
>How do you deal with that problem(I want movei to be able to play with ponder on
>even at 5 seconds per game without losing on time at least if I disable
>animation under winboard).
>
>I guess that a possible way is simply to agree to be slowed down by a
>significant factor during pondering when you are in time trouble and accept
>losing nearly 0.01 seconds when you are not in time trouble.
>
>Is there a better way?
>
>
>Uri


Yes.  Look at your target move time.  If it is small, check frequently.  If you
are playing a game where you are averaging 3 minutes per move, checking for
input more than once per second will have no benefit.  But on ICC, in a 1 0
bullet game, you might end up checking every .1 seconds or even less as you
don't want to lose .1 seconds per move if you only have 2 seconds left...




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.