Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!newsserver.jvnc.net!news.ge.com!ctrlnews.erie.ge.com!news.crd.ge.com!news.sprintlink.net!newsserver.pixel.kodak.com!bloom-beacon.mit.edu!newsfeed.internetmci.com!in2.uu.net!panix!news.columbia.edu!lamont!lawlib.wm.edu!msphil
From: msphil@aardvark.cc.wm.edu (Michael S. Phillips)
Subject: Re: Limitations of Inform and TADS?
Message-ID: <1995Nov3.212049.26736@lamont.ldgo.columbia.edu>
Sender: msphil@skaro.lawlib.wm.edu (Michael S. Phillips)
Organization: Marshall-Wythe Law Library
X-Newsreader: xrn 7.03
References: <4775gf$pa@uwm.edu> <478i7t$mkv@life.ai.mit.edu> <GDR11.95Nov3143447@stint.cl.cam.ac.uk>
Date: Fri, 3 Nov 1995 21:20:49 GMT
Lines: 41

In article <GDR11.95Nov3143447@stint.cl.cam.ac.uk>, gdr11@cl.cam.ac.uk (Gareth Rees) writes:
|> Carl de Marcken <cgdemarc@theta.ai.mit.edu> wrote:
|> > More interesting examples could come from production rule languages.  If a
|> > dam releases water when 1) there is water behind it and 2) it is open, we
|> > would currently implement this by putting sentinels on water-extracting
|> > code and on the dam-opening code
|> 
|> If I were programming this, I'd write a daemon that monitored the state
|> of the water and the dam every turn; in Inform it would look something
|> like
|> 
|>    Object Dam
|>     with  ...,
|>           daemon [;
|>               if (self.water_level > 5 && FloodGates has open)
|>                   ! release the water
|>           ];

I have been working on an adaptive hints drop-in library for Inform, and 
I have been tinkering with daemons and the like.  On my piddly 386SX20,
the above solution (with the amount that the hints module has to do to 
check game status) is significantly slower than, say:

! Note that this is declared as part of the player, but concealed, 
! so the each_turn *is* done each turn.
Object Dam_Checker selfobj
 with  concealed...
       each_turn [;
           if (Dam.water_level > 5) && FloodGates has open)
               ! release the water
       ];

Like the daemon, this has the advantage of holding all the code within a 
single object (with the exception of the one variable), and it *seems*
to run faster when dealing with large numbers of daemons.

Of course, I could be dreaming :-)

*Is* this solution faster than such a daemon?

    Mike Phillips, msphil@aardvark.cc.wm.edu
