Author: Dan Homan
Date: 07:06:50 07/29/99
Go up one level in this thread
On July 29, 1999 at 10:00:41, Dan Homan wrote: >On July 29, 1999 at 09:43:00, frank phillips wrote: > >>On July 28, 1999 at 23:20:22, Robert Hyatt wrote: >> >>>On July 28, 1999 at 16:16:56, Frank Phillips wrote: >>> >>>> >>>>I had hoped that testing for input during pondering would be as simple as >>>>copying the Inter()/CheckInput() code from ExChess/Crafty, but I seem to be >>>>missing something. >>>> >>>>Everything works fine in a non-xboard mode DOS box (simple kbhit()), but my >>>>program (called Searcher by the way) has stopped recognising input from >>>>WinBoard. >>>> >>>>In xboard mode I set setbuf(stdin, NULL) and signal(SIGINT, SIG_IGN). >>>> >>>>Any help or hints would be greatly appreciated, although I should point out that >>>>I know nothing about Pipes and so forth. >>>> >>>>Frank >>> >>> >>>Simply copy the CheckInput() function from Crafty. In a dos box, kbhit() is >>>ok. With winboard, you need PeekNamedPipe(). >> >> >>Bob >> >>Thanks for the response, but I obviously did not express myself clearly enough. >>What you suggest is exactly what I did. It worked in a DOS box but not with >>WinBoard, and I wondered whether it should have worked or if there is something >>else I needed to do. >> >>Frank > >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 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.