From 3e5d0d5844d9e747dd8b5995e5e1d5112800d85e Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sat, 5 Jan 2019 12:38:39 +0100 Subject: Prolog: add short intro for family_relations set --- prolog/problems/family_relations/en.py | 9 ++++- prolog/problems/family_relations/intro_en.html | 49 ++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 prolog/problems/family_relations/intro_en.html diff --git a/prolog/problems/family_relations/en.py b/prolog/problems/family_relations/en.py index dd8f6d6..a57ff7f 100644 --- a/prolog/problems/family_relations/en.py +++ b/prolog/problems/family_relations/en.py @@ -1,2 +1,9 @@ name = 'Family relations' -description = 'First steps in Prolog, defining rules for various family relations.' +description = '''\ +

+First steps in Prolog: defining rules for various family relations. +For tasks in this set a database of family trees is already defined. +In Prolog, this information is represented with the predicates parent/2, +male/1 and female/1. +

+''' diff --git a/prolog/problems/family_relations/intro_en.html b/prolog/problems/family_relations/intro_en.html new file mode 100644 index 0000000..6f2a8d6 --- /dev/null +++ b/prolog/problems/family_relations/intro_en.html @@ -0,0 +1,49 @@ + + + + + Prolog: family relations + + + + + +

Prolog: family relations

+

+The first set of tasks is an introduction to Prolog. At the same time we will refresh our knowledge of family relations – that’s right, we will deal with aunts, uncles, grandparents, ancestors and descendants. +

+ +

Knowledge base

+

+Everything Prolog knows is written in its knowledge base, which is simply a Prolog program. This is usually loaded from one or more files, which are loaded automatically in CodeQ. The figure below shows a graphical representation of the knowledge base for this set. +

+ +
+ + + +
The graph (forest) of family relations
+
+ +

+The knowledge base itself is of course not represented in graphical form; it actually looks like this: +

+
+parent(tina, william).
+parent(thomas, william).
+parent(thomas, sally).
+parent(thomas, jeffrey).
+parent(william, vanessa).
+…
+female(tina).
+female(sally).
+female(vanessa).
+…
+male(william).
+male(thomas).
+male(jeffrey).
+…
+
+ + + -- cgit v1.2.1