From 138610b0709d6e251c16b391242023eec393d775 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 15 Feb 2016 20:17:49 +0100 Subject: Prolog: add a graph of family relations --- prolog/problems/family_relations/ancestor_2/sl.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'prolog/problems/family_relations/ancestor_2') diff --git a/prolog/problems/family_relations/ancestor_2/sl.py b/prolog/problems/family_relations/ancestor_2/sl.py index 0308cde..081732b 100644 --- a/prolog/problems/family_relations/ancestor_2/sl.py +++ b/prolog/problems/family_relations/ancestor_2/sl.py @@ -4,13 +4,17 @@ name = 'ancestor/2' slug = 'X je prednik od Y' description = '''\ -

ancestor(?X, ?Y): X je prednik (oče, mama, dedek, …) od Y.

-
-?- ancestor(patricia, X).
-  X = john ;
-  X = michael ;
-  X = michelle.
-
''' +

ancestor(?X, ?Y): X je prednik (oče, mama, babica, +pradedek, …) od Y.

+?- ancestor(patricia, Y).
+  Y = john ;
+  Y = michael ;
+  Y = michelle.
+
+

Družinska drevesa so +podana s predikati parent/2, male/1 in +female/1.

+''' plan = ['''\

Sedaj pa bo potrebna rekurzija... kako lahko problem prevedem na (en korak) manjši problem?

-- cgit v1.2.1