Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Engine programming - standard input

Author: Robert Hyatt

Date: 09:00:28 12/03/03

Go up one level in this thread


On December 03, 2003 at 11:39:55, martin fierz wrote:

>On December 03, 2003 at 11:24:30, Robert Hyatt wrote:
>
>[snip]
>
>>My point was that how you check for input influences how you design your
>>basic engine.  IE if it has to poll, you have to include code to do that
>>and the resulting spaghetti stuff to allow moves to be entered while a
>>search is in progress, without re-starting the search, etc...  If you
>>decide to use a separate thread, then you have to decide how to handle
>>the engine thread.  Ken Thompson simply started a search thread, and if
>>the expected move was made, he waiting for the result.  If the wrong
>>move was made (not predicted) he just killed the search thread and started
>>a new one.
>
>if i decide today that i want to use a separate thread to handle the input
>(rather than the polling thing i'm doing now), it will take me a few hours to
>implement, perhaps a day if it gets bad.

yes, but if you decide before you write, it won't take _any_ time.  That is
my point.  And you don't have to modify existing code.  I originally used
two threads as that was almost necessary on the Cray.  I later went to polling
to support PC machines prior to using winboard.  It wasn't terribly hard, but
it involved a lot of changes.  An engine without pondering is much simpler
than one with.

>
>doing it in ken thompson's simple but rather effective way will definitely only
>take couple of hours.

Yes.  If you can do that.  But try it in a "DOS" version.  :)





>
>my "spaghetti stuff" is something like 5 lines of code in my alphabeta function,
>which took me a few minutes to write, plus a check at the end of the search
>which takes another couple of lines.

There must be more.  You have to read in a move in the main program.  But
if you read it during a ponder search and was correct, then you have to avoid
that read since you already have the move.  IE it trickles down and adds a
few lines here, a few lines there, and before you know it, you are debugging.

I have a "puzzle search" to find a ponder move.  It is possible that I get
a move while trying to find a move to ponder.  That is yet another complication
that has to be worked around...



>
>>All of that influences how things will work.  You don't necessarily have to
>>write all the code first, but you really ought to have an overall design of
>>how the system will operate, before _anything_ gets written.
>
>everybody knows that. nobody does it ;-) or if they do, they change the design
>later anyway. are you telling me you never changed anything in cray blitz or
>crafty??
>


In Cray Blitz, I didn't change the basic I/O methodology.  I copied that in
crafty, but then totally re-did it so I could develop on a PC using MSDOS,
which didn't support a second thread in any way...  I had to poll.





>
>>but you ought to have some idea of how you plan to handle
>>pondering, before you start, so that you don't start down a path that won't
>>work without lots of (later) modifications and debugging.
>
>i have a plan for that - and as i said i don't believe it will take much effort
>to implement. perhaps i'm underestimating the problem of course :-)
>
>i really think you ought to have a plan how to make the thing play a decent
>game. that seems by far more important than the relatively minor issue of
>pondering. and since i don't have a plan for that, i just go ahead and try...
>
>cheers
>  martin



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.