Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Communication between two program versions

Author: Peter Fendrich

Date: 15:28:15 09/07/00

Go up one level in this thread


On September 07, 2000 at 15:00:26, Leen Ammeraal wrote:

>On September 07, 2000 at 12:30:31, Peter Fendrich wrote:
>
>>
>>I do this now and then and it works just great. (However I don't think it is of
>>that great value to play different versions of my own program against each
>>other)
>>If you can run the two versions on same time on the same computer without any
>>problems it can also be done under Winboard.
>>You have to reduce hash table size and other things like that because they have
>>to share the same memory. You'd better turn off pondering on opponents time if
>>you have that option.
>>
>>//Peter
>(Subject: Two program version running at the same time
>and playing against each other.)
>
>Thanks, but my question was: could you please give me a hint
>how to program this (preferably without using Winboard).
>I am a reasonably experienced C++ programmer, but I have never
>programmed any communication between independent programs
>running at the same time. I do not worry about memory, since
>I have 128 MB and much smaller hash tables.
>If you have any programming experience with this problem,
>please let me know which system routines you use and how.
>Leen
Ok, Sorry. I once tried to do this in VB but never worked any good.

From what I know you have at least these choices:
1) Code it as in WinBoard and take control of both the programs stdin/stdout
streams. He (Tim Mann) creates 'anonymous pipes' to serve as the child's stdin
and stdout, pass one end of each in the siStartInfo argument to CreateProcess,
then read/write the opposite ends.
Look in winboard.c, procedure StartChildProcess, for the setup. Also look at
AddInputSource and *InputThread to see how he uses threads to asynchronously
read data from the engine's stdout pipe and convert it to Windows messages.

or if you don't like the Winboard way at all:
2) Create a small administrator that loads the two programs and starts them as
two different processes. Communicate with them through a Virtual File, kind of
file in memory (at least in MS C/C++). Your both programs waits for input by
opening, reading and closing the file waits for a certain interval before doing
it again. The administrator reads the move from the program A file, writes back
a wait signal, writes the move to the program B file and clears the wait signal
in the program B file.

I havn't done this myself but think it will work in this or a similar way with
virtual files.

//Peter
//Peter






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.