Ponder console input move problem

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

vladstamate
Posts: 161
Joined: Thu Jan 08, 2009 9:06 pm
Location: San Francisco, USA

Ponder console input move problem

Post by vladstamate »

Hi all,

I added ponder to plisk and logically all works fine. I have a problem however with my code that detects if a move is being fed to the program while it is pondering.

In windows I use the usual PeekNamedPipe/PeekConsoleInput and then if anything is there, I do a fgets to get the move string.

If ran under winboard, so with a pipe, everything seems fine. However if I run from the debugger or a console, it breaks. What happens is that when I do fgets the first 2 chars in the string are replaced by 'p' and 0 (so 70 and 0). So a move like "h2h3" gets transformed into 'p',0,'h','3'. Therefore making it very hard for me to debug some issues I have.

Maybe a memory corruption issue, but why does it not happen in pipe mode? Must be something stupid I do but for the life of me I cannot figure it out.

Has anyone seen anything like this?

Regards,
Vlad.
brianr
Posts: 536
Joined: Thu Mar 09, 2006 3:01 pm

Re: Ponder console input move problem

Post by brianr »

Different input modes are used, unfortunately.

Look at Crafty's CheckInput() in utility.c
where several input options are supported.