Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!newsserver.jvnc.net!newsserver2.jvnc.net!news.cac.psu.edu!news.math.psu.edu!chi-news.cic.net!news.wctc.net!spcuna!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: <1995Nov4.210542.4689@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> <8katdK200WB8J2Knx=@andrew.cmu.edu>
Date: Sat, 4 Nov 1995 21:05:42 GMT
Lines: 46

In article <8katdK200WB8J2Knx=@andrew.cmu.edu>, "Andrew C. Plotkin" <erkyrath+@CMU.EDU> writes:
|> msphil@aardvark.cc.wm.edu (Michael S. Phillips) writes:
|> > In article <GDR11.95Nov3143447@stint.cl.cam.ac.uk>, gdr11@cl.cam.ac.uk (Gareth\
|> >  Rees) writes:
|> > |>    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
                        ^^^^^^^Note this!

|> >  with  concealed...
|> >        each_turn [;
|> >            if (Dam.water_level > 5) && FloodGates has open)
|> >                ! release the water
|> >        ];
|> >
|> > *Is* this solution faster than such a daemon?
|> 
|> Of course it is. each_turns are only executed when you're in the same
|> room (really, in scope). So if you have a bunch of your examples in
|> many different rooms, only one will be executed per turn. Whereas all
|> active daemons execute every turn.
|> 
|> The question, of course, is whether it's acceptable for the water to
|> only release when you're in the dam room.

Note that the Dam_Checker is a concealed part of the player object 
(selfobj), which means the each_turn *is* run each turn.  However,
it still *seems* to run faster.  I haven't yet done an absolute 
comparison between a daemon running it and an each_turn running it,
but it sure seems to run faster and run each turn.

Sorry if I didn't make that clear.

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