🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.perl.misc
Article #374

Re: Parsing gnuchess output

#374
From: Tom Kerrigan
Date: Sat, 27 Jul 1996 00:00
33 lines
1983 bytes
Michael Kerry (msk@icf.hrb.com) wrote:
: Can anyone give me a hint as to how to go about writing a perl script to
: act as an interface to gnuchess?  I am not concerned with a graphical
: interface at this point, just the mechanics of inputing moves to the
: gnuchess engine and then receiving responses.  

: I tried fiddling around with opening a handle to "gnuchessc |" and
: reading from it (which seemed to work), but then how do you input moves?
: Is there a bi-directional pipe?!?  Surely there's a more clever way...

: Yes, this is a silly thing to want to do, but I'm doing it more to learn
: perl rather than to write a gnuchess interface, since there's already a
: bunch out there.

: Thanx.
: -MK

I just recently wrote an autoplayer to play games between Stobor and Crafty (which 
is too buggy on an HP workstation to finish a single game) and between Stobor and 
Zarkov. I first create a pipe, then I run the other program with fork() and 
exec(), and then I use dup2() to switch stdin and stdout around. So far it works 
great.

BTW, remember to close the child program *before* breaking the pipe. :)

Cheers,
Tom

_______________________________________________________________________________
Tom Kerrigan  kerrigan@frii.com  O-

Save the whales.  Collect the whole set.
Technical Details
Message-ID: <4te2sk$kbg@europa.frii.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <31F7E0C5.218D@icf.hrb.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fa0ae,458d07b729e8663
X-Google-Attributes: gidfa0ae,public
X-Google-Thread: 110df2,458d07b729e8663
X-Google-Attributes: gid110df2,public
X-Google-Thread: 10d71d,458d07b729e8663
X-Google-Attributes: gid10d71d,public
From: kerrigan@frii.com (Tom Kerrigan)
Subject: Re: Parsing gnuchess output
Date: 1996/07/27
Message-ID: <4te2sk$kbg@europa.frii.com>
X-Deja-AN: 170490527
references: <31F7E0C5.218D@icf.hrb.com>
followup-to: comp.lang.perl.misc,rec.games.chess.computer,gnu.chess
organization: Front Range Internet, Inc.
newsgroups: comp.lang.perl.misc,rec.games.chess.computer,gnu.chess