Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Delphi and the UCI Protokoll

Author: Steve Maughan

Date: 01:20:57 04/19/02

Go up one level in this thread


Martin,

>has anybody experience with Delphi and the new UCI Protokoll?

Yes.  Monarch is UCI compatible and written in Delphi (www.stevemaughan.com)

>In my small chess program it works so far, but I have a some problems i want to
>fix. They are very Delphi specific.
>
>First problem:
>
>commands are closed by \n (=ASCII #10). But the readln command of delphi expects
>#13#10. I did a work around with something like that:
>
>var c : char; s : string;
>repeat
>  read(c);
>  s := s + c;
>until #10
>
>now s is the command. But that looks not nice.

This is the best way to read the input!  Not really that unattractive and it
works!

>second problem:
>the engine must always be able to process input from stdin, even while thinking.
>
>What is the best and efficient way to do this?

You need to create a separate threat to read the input while the main thread
does the thinking.  This is not at tough as it sounds.  The command to create a
thread is:

  createthread(nil,0,@read_winboard,nil,0,ThreadID);

where read_winboard reads the input and ThreadID is of type THandle.  You cannot
easily use Delphi's TThread object as it will not work (easily) as a console
app.

>I tried a timer, this works fine if the program is running without fritz, but
>with fritz the times stand still while calculating. May be this is a problem
>with the namesspace?

Don't go near timers when creating a console app - in my experience there are
many problems, like the ones you've seen.

Good luck!

Regards,

Steve



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.