🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Parsing gnuchess output

#375
From: DJ Delorie
Date: Sun, 28 Jul 1996 00:00
25 lines
1810 bytes

In article <31F7E0C5.218D@icf.hrb.com> Michael Kerry <msk@icf.hrb.com> writes:
> 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.

I've already done all this at http://www.delorie.com/game-room/chess/

About 2500 games are started each week (~250-425 per day).  The
computer wins around 80% of the games that are played to completion.

To connect to gnuchess, open *two* pipes, fork, use open(STDIN,
">&PIPE1") (etc) to connect the other sides of the pipes to
stdin/stdout, then exec("gnuchess").  Don't forget to set $| on the
pipes.  Also, try open2().
Technical Details
Message-ID: <DJ.96Jul27200527@delorie.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: 110df2,458d07b729e8663
X-Google-Attributes: gid110df2,public
X-Google-Thread: fa0ae,458d07b729e8663
X-Google-Attributes: gidfa0ae,public
X-Google-Thread: 10d71d,458d07b729e8663
X-Google-Attributes: gid10d71d,public
From: dj@delorie.com (DJ Delorie)
Subject: Re: Parsing gnuchess output
Date: 1996/07/28
Message-ID: <DJ.96Jul27200527@delorie.com>
X-Deja-AN: 170514150
x-nntp-posting-host: delorie.com
references: <31F7E0C5.218D@icf.hrb.com>
organization: DJ Delorie/DJGPP Support
newsgroups: comp.lang.perl.misc,rec.games.chess.computer,gnu.chess