OK, this is driving me nuts, so I hope some of you might have suggestions. I started a C version of my chess program NOW about a year ago. After about a month of programming, I went crazy trying to figure out why the program sometimes hangs. When operated manually from the command line, it never hangs. When using a GUI like Arena, it sometimes hangs as follows:
The GUI send two command rapidly one after the other. The first is a position command, like this:
position startpos moves e2e4 e7e5 d2d3
then next, sent right after that one is the go command, with the time parameters. As far as I can tell the GUI sends one right after the other with no pause or "isready" command to verify the engine is ready.
My program always reads the move command, but it sometimes seems to not get the go command. It just sits there and lest the clock run down. This appears to happen randomly, although perhaps a bit more if the engine is playing black. It is as if the go command is just throw out by the operating system
Suggestions? I can post some sample code or send it to a genius willing to help.
Mark
Input problems with UCI Interface
Moderators: hgm, Rebel, chrisw
-
- Posts: 1808
- Joined: Wed Mar 08, 2006 9:19 pm
- Location: Oslo, Norway
Re: Input problems with UCI Interface
Hello Mark,
Are you sure you have disabled IO buffering? Your initialization code should contain something similar to this:
Tord
Are you sure you have disabled IO buffering? Your initialization code should contain something similar to this:
Code: Select all
setbuf(stdout, NULL);
setbuf(stdin, NULL);
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stdin, NULL, _IONBF, 0);
-
- Posts: 1494
- Joined: Thu Mar 30, 2006 2:08 pm
Re: Input problems with UCI Interface
I did have those in there, but for reasons I cannot explain, the setbuf() calls were put in after one of the reads. Thanks Tord! I owe you a beer (or do you have some exotic pickled fish liquor up there in Norway!Tord Romstad wrote:Hello Mark,
Are you sure you have disabled IO buffering? Your initialization code should contain something similar to this:
TordCode: Select all
setbuf(stdout, NULL); setbuf(stdin, NULL); setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stdin, NULL, _IONBF, 0);
-
- Posts: 1808
- Joined: Wed Mar 08, 2006 9:19 pm
- Location: Oslo, Norway
Re: Input problems with UCI Interface
Hi Mark,
I'm glad you solved your problem!
I prefer the beer, please.
Tord
I'm glad you solved your problem!
We don't -- our local specialty in Norway is "hjemmebrent", home-distilled alcohol made from potatoes and sugar. It is illegal, but quite popular in some districts (especially in the middle and northern part of the country), mainly because of the high taxation for legally bought alcohol. The quality is invariably terrible.mjlef wrote:I did have those in there, but for reasons I cannot explain, the setbuf() calls were put in after one of the reads. Thanks Tord! I owe you a beer (or do you have some exotic pickled fish liquor up there in Norway!
I prefer the beer, please.
Tord