Newsgroups: rec.arts.int-fiction
Path: gmd.de!xlink.net!news.belwue.de!news.dfn.de!scsing.switch.ch!swidir.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!batcomputer!hookup!news.kei.com!eff!news.umbc.edu!europa.eng.gtefsd.com!howland.reston.ans.net!torn!watserv2.uwaterloo.ca!undergrad.math.uwaterloo.ca!mlvanbie
From: mlvanbie@undergrad.math.uwaterloo.ca (Michael Van Biesbrouck)
Subject: Re: Prolog for writing IF?
Message-ID: <Cn1EII.DAt@undergrad.math.uwaterloo.ca>
Sender: news@undergrad.math.uwaterloo.ca (news spool owner)
Organization: University of Waterloo
References: <yjc-170394003032@b61539.student.cwru.edu> <2mae2b$u5j@msuinfo.cl.msu.edu> <CMxqDG.C62@undergrad.math.uwaterloo.ca> <D91FE.94Mar20044354@krokis.pt.hk-r.se>
Date: Mon, 21 Mar 1994 22:59:06 GMT
Lines: 63

In article <D91FE.94Mar20044354@krokis.pt.hk-r.se>,
Fredrik Ekman <d91fe@krokis.pt.hk-r.se> wrote:
>Well, I still claim that efficiency is a problem. Admitted; my only
>experiences with prolog is through MacProlog 3.5 and some ancient
>version of Turbo Prolog, but unless there are Prolog implementations

[There was only one version of Turbo Prolog ... it was bought from
Borland a few years ago and underwent a name change.]

>that are extremely more efficient than those, then the mighty
>rescue-the-princess-by-hacking-your-way-through-five-hundred-castles
>adventure is quite impossible. Actually, even a more realistic
>approach, or even a large demo, would make at least MacProlog choke.
>And even if it could handle it, it would still be painfully slow,
>no matter how many smart cuts and optimization routines you write.
>
>Please prove me wrong. I'd love to be able to write adventures in
>Prolog. I just don't think it's practically possible.

There are far more efficient versions of Prolog available, and the FAQ
for comp.lang.prolog will point you to a horde of them.  I can't prove
you wrong because I haven't finished my work on my own version of Prolog
for writing IF in (making certain assumptions and optimizations because
of the special purpose).  I want to redesign the interpreter before
continuing the coding.  Since my Prolog-like code is written for a
completely different syntax, I cannot quickly provide a demonstration.

I suggest you read
ftp://ai.uga.edu/pub/ai.reportsd/ai198908.ps.Z
if you still have problems with efficiency.

However, there still is one area in which Prolog implementations tend to
have problems (get ready to skewer me for this):  strings.  Technically,
in Prolog a string is represented as a list of single character values
... this means that a room description might take 8 times the space it
should.  Some implementations attempt to address this issue by providing
constant strings (using a different style of quote).

Most of the things that you will need to do can be accomplished with a
ASCIIZ string ("Hello\000") and a non-copying (memory usage efficient)
implementation of Prolog in a trivial manner.  However, programmers
might want to have all of power of Prolog strings at their disposal
and begin building lists from the bottom up instead of just taking the
first n elements off.  The model becomes complicated in one of two ways
(as far as I can figure out).  A data copying implementation will work
fairly inefficiently on ASCIIZ strings, but is not complicated by this
addition.  The inefficiencies are both in time and memory.

Calling the C function strcat() in the middle of a Prolog program
(ASCIIZ implementation, of some sort) would solve all of these problems.
Hopefully there is a Prolog implementation other than Turbo Prolog that
does this or something equivalent.

I don't think this message was very clear.  I drew random bits from my
(imperfect) knowledge of Prolog implementation and added odds and ends
from my own notes on the string problem.  If you ask for clarification
on specific parts, I will greatly elaborate.

-- 
Michael Van Biesbrouck, UW CSC Librarian
gopher://descartes.uwaterloo.ca/h0/mathSOC/.csc/.www/.mlvanbie/homepage.html
	Spin-doctors are like evil anti-librarians; they're
	the Dark Side of the Force. -- Bruce Sterling
