[Q] Is a newer version of the Prolog implementation available?

Hannes Hirzel hirzel at spw.unizh.ch
Wed Mar 6 14:25:06 UTC 2002


Alan


On Wed, 6 Mar 2002, Alan Kay wrote:

> Hannes --
> 
> Try making Mike Teng's example work. This was a kind of Monkey and 
> Bananas problem using a dog, and it animated the solotion in the 
> original DigiTalk version. The example (and the code for it) are in 
> the original documentation, which should be near the Prolog system 
> code.
> 
> Cheers,
> 
> Alan
> 
> -------

Thank you for the suggestion.

Yes, I would be interesting in doing that. The documentation which comes
with the port (http://www.cc.gatech.edu/projects/squeakers/25.html)
is helpful. I especially like the way how Prolog is embedded into
Squeak. The unification and backward-chaining in Prolog is handy, but for 
other things I consider Squeak to be much easier to use. Exciting
is the possibility to have different "expert system" objects I can 
send prolog queries to and get a Smalltalk array back with the answers.


The example you mention is the Dungeon example; the docu says

DUNGEON EXAMPLE
>If you have installed the 'prolog.st' file and opened a Logic Browser,
>you can browse the code contained in class Dungeon.  This example ties
> the Smalltalk graphics drawing and animation together with the Prolog/V
> inferencing power.  To run this example, evaluate the following in any
> text pane:
>	Dungeon new :? go()
>       Squeak:	Dungeon example is not fully implemented
> After initialization, a map of the dungeon is shown, and a dog tries 
> to go from entry to exit and finds the gold treasure.  It turns back
> when one of the dangerous rooms is encountered.
> The speed of the dog can be changed in the 'initialize:' method.  
> The dangerous rooms is also set in the same method.  The map of 
> the dungeon can be altered by changing the 'gallery:' and 'position:'
> predicates.
 
The class comment of #Dungeon says
>Incomplete
>
>ISSUE: Animation
>Smalltalk/V uses a slightly different approach.
>We'll either adopt it, or use Morphic.
>
>ISSUE: Stack size limit
>A few methods didn't compile (and have big portions commented out)
>
>ISSUE: Bugs
>An ongoing attempt to rewrite this example is incomplete.

The database is defined as follows

>"Define database of all connecting rooms."
>gallery(#entry,#monsters).
>gallery(#entry,#stadium).
>gallery(#stadium,#hell).
>gallery(#stadium,#dolphin).
>gallery(#stadium,#pond).
>gallery(#exit,#gold).
>gallery(#robbers,#gold).
>gallery(#stadium,#robbers).
>gallery(#pond,#gold).
>gallery(#dolphin,#exit).
>gallery(#monsters,#gold).

"Define the position of each room on screen."
>position2(#entry,40 at 80).
>position2(#stadium,230 at 50).
>position2(#monsters,40 at 200).
>position2(#hell,90 at 310).
>position2(#pond,330 at 160).
>position2(#gold,460 at 200).
>position2(#dolphin,380 at 70).
>position2(#robbers,230 at 310).
>position2(#exit,580 at 180).

And the main route finding clauses are
>"Find the route to the next room avoiding
> dangerous or visited rooms."
>route(#exit,#exit,visitedRooms) :-
>	isFinished(visitedRooms).
>route(#exit,_,_).
>route(room,wayOut,visitedRooms) :-
>	neighborroom(room,nextRoom,visitedRooms),
>	not(member(nextRoom,visitedRooms)),
>	gotoAndAvoid(nextRoom,dangerousRooms,room),
>	route(nextRoom,wayOut,[nextRoom|visitedRooms]).
>
>"couldn't compile the below: stack too deep"
>"route(room,wayOut,visitedRooms) :-
>	not(eq(room, #exit)),
>	neighborroom(room,nextRoom,visitedRooms),
>	not(member(nextRoom,visitedRooms)),
>	gotoAndAvoid(nextRoom,dangerousRooms,room),
>	route(nextRoom,wayOut,[nextRoom|visitedRooms])."

I think I try first one of the standard Prolog text book maze
traversing example first (without graphics) and then try to
add a Morphic animation.

Regards
Hannes Hirzel




More information about the Squeak-dev mailing list