Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: WinBoard and pondering under W98

Author: Frank Phillips

Date: 12:39:48 07/31/99

Go up one level in this thread


On July 29, 1999 at 10:33:58, Robert Hyatt wrote:

[snip]

>>>
>>>One problem I had was with the input buffering of the c++ "cin" statement
>>>which I was using to read in input from winboard (and xboard).  I am
>>>sure that similar problems exist if you are using "scanf" in c.  What
>>>happens is that the data gets read into the input buffer before you call
>>>"PeekNamedPipe()" so "PeekNamedPipe()" doesn't see any input.
>>>
>>>What I did in EXchess to fix this is to check "cin->in_avail()" to see
>>>if anything was in the input buffer.  This solved the problem for me.
>>>I notice that you do "setbuf(stdin, NULL)" in xboard to prevent
>>>this problem... I haven't tried this so I don't know if there are any
>>>pitfalls.
>>>
>>>One thing to be sure to try with Winboard or Xboard is the "-debug"
>>>flag....  This can often give you an excellent idea of what is going
>>>on by showing you exactly what messages were sent between the two
>>>programs.
>>>
>>> - Dan
>>
>>Another good idea is to run your program in "winboard mode" but without
>>winboard.... type all the commands yourself.  This way you can see how
>>your program responds - you should probably add some output statements
>>for debugging purposes so you can see exactly what your program recieves
>>and what it doesn't.
>>
>> - Dan
>
>
>This probably won't help...  in that you can't possibly type fast enough to
>stuff data into the internal buffer faster than the program can suck it out
>and handle it.  Winboard (a separate process) can send multiple messages and
>deliver them to the buffer to your process _before_ your process gets a chance
>to execute and read them.  Then you run right into the buffering wall...

Dan and Bob

Thanks.  Had not appreciated the connection with buffered input.  Using C++ cin
functions (instead of C) solved the problem – and I did not have to do the
buffering.

Frank




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.