summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations
diff options
context:
space:
mode:
authorAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-02-29 17:40:06 +0100
committerAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-02-29 17:40:06 +0100
commitd9809e87882a4248e215ee423c3fdb2fb5f6ee2d (patch)
treea901d7b36754e299bcd9260a9656cd48f0b6ba24 /prolog/problems/family_relations
parent815063053ef46e3baad68564585c306fc559eaad (diff)
Improved hints for cousin/2.
Diffstat (limited to 'prolog/problems/family_relations')
-rw-r--r--prolog/problems/family_relations/cousin_2/common.py11
-rw-r--r--prolog/problems/family_relations/cousin_2/sl.py1
2 files changed, 6 insertions, 6 deletions
diff --git a/prolog/problems/family_relations/cousin_2/common.py b/prolog/problems/family_relations/cousin_2/common.py
index 86ef5cc..ffebdae 100644
--- a/prolog/problems/family_relations/cousin_2/common.py
+++ b/prolog/problems/family_relations/cousin_2/common.py
@@ -97,17 +97,16 @@ def hint(code, aux_code):
'findall(_, cousin(X, Y), L), (length(L, 14) ; length(L, 16))'):
return [{'id': 'precedence_fail'}]
- # cousin should not be brother or sister
- # common parent, probably solved via grandparent
- if prolog.engine.ask_truth(engine_id,
- 'cousin(X, Y), (brother(X, Y) ; sister(X, Y))'):
- return [{'id': 'cousin_vs_sibling'}]
-
# cousin to him/herself
# just common grandparent is not enough
if prolog.engine.ask_truth(engine_id, 'cousin(X, X)'):
return [{'id': 'cousin_to_oneself'}]
+ # cousin should not be brother or sister
+ # common parent, probably solved via grandparent
+ if prolog.engine.ask_truth(engine_id,
+ 'cousin(X, Y), parent(P, X), parent(P, Y)'):
+ return [{'id': 'cousin_vs_sibling'}]
# X (or Y) does not necessarily need to be a parent
# cousin is a symmetrical relation, so X and Y are covered by this
diff --git a/prolog/problems/family_relations/cousin_2/sl.py b/prolog/problems/family_relations/cousin_2/sl.py
index c1380bf..3719368 100644
--- a/prolog/problems/family_relations/cousin_2/sl.py
+++ b/prolog/problems/family_relations/cousin_2/sl.py
@@ -54,6 +54,7 @@ Si morda pozabil, da starša od <code>X</code> in <code>Y</code> ne smeta biti i
<p>Kako je lahko nekdo bratranec/sestrična samemu sebi?
Imata morda <code>X</code> in <code>Y</code> istega starša?</p>
<p><img src="[%@resource Prolog_cousin_04.svg%]" /></p>
+<p>Poskusi prolog vprašati tole: <code>?- cousin(X, X).</code>?</p>
''',
'cousin_need_not_be_parent': '''\