Article View: comp.lang.perl.misc
Article #373Re: Parsing gnuchess output
From: Quentin Fennessy
Date: Fri, 26 Jul 1996 00:00
Date: Fri, 26 Jul 1996 00:00
28 lines
1741 bytes
1741 bytes
In article <31F7E0C5.218D@icf.hrb.com>, 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... Reading to and writing using pipes can easily cause a program to deadlock. Check out open2.pl or open3.pl for some help. Programs can deadlock when they - generate input for a program - waiting for output from the program - while the program is waiting on more input. So unless you know exactly what data to send to a program so that it does not expect more data before it outputs your perl program may hang forever. Of course you can use timeouts for this. -- Quentin Fennessy AMD, Austin Texas
Technical Details
Message-ID:
<Dv61ts.Av@txnews.amd.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<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: 10d71d,458d07b729e8663 X-Google-Attributes: gid10d71d,public X-Google-Thread: fa0ae,458d07b729e8663 X-Google-Attributes: gidfa0ae,public From: quentin@benson.amd.com (Quentin Fennessy) Subject: Re: Parsing gnuchess output Date: 1996/07/26 Message-ID: <Dv61ts.Av@txnews.amd.com> X-Deja-AN: 170346397 sender: news@txnews.amd.com references: <31F7E0C5.218D@icf.hrb.com> organization: Advanced Micro Devices, Austin, TX, USA newsgroups: comp.lang.perl.misc,rec.games.chess.computer,gnu.chess