summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/aunt_2/en.py
blob: f8bf35b65a8433a2eda0decdb044b8f1b426c7ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name = 'aunt/2'
slug = 'the aunt relation'

description = '''\
<p><code>aunt(X, Y)</code>: <code>X</code> is an aunt of <code>Y</code>.</p>
<pre>
?- aunt(sally, X).
  X = vanessa ;
  X = patricia.
</pre>
<p><a target="_blank" href="[%@resource famrel.svg%]">Family trees</a> are
described with predicates <code>parent/2</code>, <code>male/1</code>, and
<code>female/1</code>.</p>
'''

plan = ['''\
<p>Perhaps you can make use of the solution to one of the previous exercises?</p>
<p><img src="[%@resource Prolog_aunt_06.svg%]" alt="My sibling has a child..." /></p>
''', '''\
<p>If <code>X</code> is a sister of the parent of <code>Y</code>,
then <code>X</code> is the aunt of <code>Y</code>.</p>
''', '''\
<p><img src="[%@resource Prolog_aunt_07.svg%]" alt="A sister of Y's parent is the aunt of Y." /></p>
''']

hint = {
    'x_and_y_mixed_up': '''\
<p><code>X</code> should be the aunt of <code>Y</code>, not the other way around.</p>
''',

    'precedence_fail': '''\
<p>Did you mix up the precedence of operators <em>or</em> & <em>and</em>?</p>
<p>Operator <em>and</em> has higher precedence than operator <em>or</em>.
If you wish to change that you can use brackets (as usual in mathematics).</p>
''',

    'x_must_have_sibling': '''\
<p>An aunt usually has a sibling...</p>
<p><img src="[%@resource Prolog_aunt_02.svg%]" /></p>
''',

    'x_must_be_female': '''\
<p>An aunt is usually female.</p>
<p><img src="[%@resource Prolog_aunt_05.svg%]" /></p>
''',  # TODO: Loni should mark female gender on some aunt hints!

    'y_must_have_parent': '''\
<p>It would probably make sense if the nephew has a parent, right?</p>
<p><img src="[%@resource Prolog_aunt_01.svg%]" /></p>
''',

    'aunt_vs_mother': '''\
<p>How can an aunt also be the mother of <code>Y</code>?
Did you forget to specify that an aunt and the parent of <code>Y</code> cannot be the same person?</p>
<p><img src="[%@resource Prolog_aunt_04.svg%]" /></p>
''',

    'x_need_not_be_parent': '''\
<p><code>X</code> doesn't need to have children to be somebody's aunt...</p>
''',

    'y_need_not_be_parent': '''\
<p>A nephew <code>Y</code> doesn't need to have children...</p>
''',

    'nephews_parent_can_be_male': '''\
<p>A parent of nephew <code>Y</code> can also be male
(which means that this parent cannot be a sister of <code>X</code>).</p>
''',

    'predicate_always_false': '''\
<p>It seems your predicate is <em>always</em> "false". Did you give it the correct name,
or is it perhaps misspelled?</p>
<p>If the name is correct, check whether something else is misspelled, perhaps there is a full stop instead of
a comma or vice versa, or maybe you typed a variable name in lowercase?</p>
<p>It is, of course, also possible that your conditions are too restrictive, or even impossible to satisfy
(as would be, for example, the condition that <code>X</code> is both a parent and a sister of <code>Y</code>, or
something similarly impossible).</p>
''',

    'interesting_tidbit': '''\
<p>Interesting tidbit. This exercise could also be solved using the solution to the <code>sister/2</code>
relation. An aunt is a sister of some parent of <code>Y</code>.</p>
<p><img src="[%@resource Prolog_aunt_07.svg%]" /></p>
''',    # TODO: only trigger if sister is not part of correct solution
}