One Problem -- how to implement in three programming paradigms in Python

Ludger.Humbert Ludger.Humbert at cs.uni-dortmund.de
Mon Jun 16 06:11:49 EDT 2003


Hi,
in our introduction course "didactics of informatics" for students we
want to show that it is possible to realize one problem *clean* in
several programming paradigms. We want to use Python as programming
language to implement the solutions.

The problem is shown at
 http://in.hagen.de/~humbert/vortraege/F.Grundkonzepte_html/22.html

knowledge based solution
========================
A possible solution in Prolog
 http://in.hagen.de/~humbert/vortraege/F.Grundkonzepte_html/23.html

If one uses holmes [from Mark Lutz, Programming Python,  pp 1039--1040]
the solution can be expressed as ("nach" -- german for "to"):

rules (filename labyrinth3.kb):
~~~~~
rule f01 if true then weg rein nach 28.
...
rule f20 if true then weg 41 nach raus.
rule r1 if weg ?a nach ?b, weg ?b nach ?c then tour ?a nach ?c.
rule r2 if weg ?a nach ?b, tour ?b nach ?c then tour ?a nach ?c.

the dialog in holmes:

-Holmes2 inference engine-
holmes> @= ../labyrinth3.kb
holmes> ?- tour rein nach raus
...
yes: (no variables)
show proof ? y
 "tour rein nach raus" by rule r2
     "weg rein nach 28" by rule f01
         ...

Now we are looking for other soultions, we can express in Python.


functional solution?
====================
??

objectoriented solution?
========================
??


	TNX
	Ludger Humbert





More information about the Python-list mailing list