PROLOG-REQUEST@SU-SCORE.ARPA (Chuck Restivo, The Moderator) (08/06/86)
PROLOG Digest Wednesday, 6 Aug 1986 Volume 4 : Issue 33
Today's Topics:
Puzzle - Farmer Problem,
Query - Compiler
----------------------------------------------------------------------
Date: 4 Aug 86 18:02:14 GMT
From: Mario O. Bourgoin
Subject: How should I do this?
Hello,
I am trying to write a solution program for the Farmer
problem. Simply stated:
A farmer wants to move himself, a silver fox, a fat goose and
some jucy grain across a river. Unfortunately, his boat is so
tiny he can only take one of his things across on any trip.
Worse yet, an unattended fox will eat a goose, and an
unattended goose will eat the grain, so the farmer must not
leave the fox alone with the goose or the goose alone with the
grain. What is he to do?
So far, I have stated the problem in the way outlined below. Can
someone help we to get this working? It figures out the first
alternative of moving the goose across but then starts looping
on what to do for the next move.
same(yes,1,1).
same(yes,2,2).
same(no,1,2).
same(no,2,1).
legal(state(F,X,G,A)) :-
(same(no,X,G);same(yes,F,X)),
(same(no,G,A);same(yes,F,G)).
linked(state(F1,X1,G1,A1),state(F2,X2,G2,A2)) :-
same(no,F1,F2),
(same(yes,X1,X2);(same(yes,F1,X1),same(yes,G1,G2),same
(yes,A1,A2))),
(same(yes,G1,A2);(same(yes,F1,G1),same(yes,X1,X2),same
(yes,A1,A2))),
(same(yes,A1,A2);(same(yes,F1,A1),same(yes,G1,G2),same
(yes,X1,X2))).
path(State1,State2) :-
legal(State1),legal(State2),
(linked(State1,State2);(path(State1,State3),path(State3,
State2))).
------------------------------
Date: Tue 5 Aug 86 10:15:59-CDT
From: Dave Plummer <ATP.PLUMMER@R20.UTEXAS.EDU>
Subject: Stand-alone compiler
Can anyone tell me anything about the Prolog stand-alone
compiler described in version 3 of the Edinburgh Prolog
manual? In particular:
a] Where can I get a copy ?
b] Will it compile programs written under version 3.3 of
Edinburgh Prolog?
c] Will it solve the following problem... My program is
too big for the 'incore' compiler, in that when I call
'compile(ListOfAll50Files).' with ListOfAll50Files suitably
instantiated the compiler gives the message '? heap full'
before finishing up. Will the stand-alone compiler exhibit
the same symptoms ?
Thanks you.
-- Dave
------------------------------
Date: Tue 5 Aug 86 10:35:58-PDT
From: Fernando Pereira <PEREIRA@SRI-CANDIDE.ARPA>
Subject: Re: Stand-alone compiler
That's puzzling, I don't remember there ever being a note on the
stand-alone bootstrap compiler that is used to build DEC-10/20 Prolog.
Anyway, the compiler (which I have) is not really usable for user
programs, it only works for specially prepared stand-alone programs
(like the Prolog system itself). I'm afraid your ``heap full'' problem
is the result of the limited address space of the DEC-10/20 machines
(256K words). The only solution I see for your problem is to use a
Prolog on a machine with a larger address space (VAX, Sun,...).
Sorry for the bad news...
-- Fernando
------------------------------
End of PROLOG Digest
********************