summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-02-29 15:40:09 +0100
committerAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-02-29 15:40:09 +0100
commitc3294f78c516f41b7ab40e67a88b874cf4a80cbb (patch)
tree8f7e363e79885bd647deaf03ee6df6a126913483
parent5402c60cc2ff966eaaada82fefe71431abae1657 (diff)
Hints for aunt/2 improved.
-rw-r--r--prolog/problems/family_relations/aunt_2/common.py7
-rw-r--r--prolog/problems/family_relations/aunt_2/sl.py5
2 files changed, 12 insertions, 0 deletions
diff --git a/prolog/problems/family_relations/aunt_2/common.py b/prolog/problems/family_relations/aunt_2/common.py
index 50c82b4..5d633fb 100644
--- a/prolog/problems/family_relations/aunt_2/common.py
+++ b/prolog/problems/family_relations/aunt_2/common.py
@@ -34,6 +34,7 @@ hint_type = {
'x_need_not_be_parent': Hint('x_need_not_be_parent'),
'y_need_not_be_parent': Hint('y_need_not_be_parent'),
'predicate_always_false': Hint('predicate_always_false'),
+ 'nephews_parent_can_be_male': Hint('nephews_parent_can_be_male'),
}
test_cases = [
@@ -96,6 +97,12 @@ def hint(code, aux_code):
'aunt(X, _), male(X)'):
return [{'id': 'x_must_be_female'}]
+ # nephew's parent can also be male
+ # this mistake comes from: parent(P, Y), sister(P, X)...
+ if prolog.engine.ask_truth(engine_id,
+ 'setof(X/Y, aunt(X, Y), [patricia/susan, vanessa/john])'):
+ return [{'id': 'nephews_parent_can_be_male'}]
+
# Y must have a parent
# perhaps risky as only one such nephew exists in DB (susan)
if prolog.engine.ask_truth(engine_id,
diff --git a/prolog/problems/family_relations/aunt_2/sl.py b/prolog/problems/family_relations/aunt_2/sl.py
index 94d0be4..1016b43 100644
--- a/prolog/problems/family_relations/aunt_2/sl.py
+++ b/prolog/problems/family_relations/aunt_2/sl.py
@@ -65,6 +65,11 @@ Si morda pozabil, da teta in starš od <code>Y</code> ne smeta biti ista oseba?<
<p>Nečak ali nečakinja <code>Y</code> pravzaprav ne rabi imeti otrok, da ima teto...</p>
''',
+ 'nephews_parent_can_be_male': '''\
+<p>Starš od nečaka <code>Y</code> je lahko tudi moškega spola
+(kar pomeni, da ne more biti sestra od <code>X</code>).</p>
+''',
+
'predicate_always_false': '''\
<p>Vse kaže, da tvoj predikat vedno vrne "false". Si mu dal pravilno ime, si se morda pri imenu zatipkal?</p>
<p>Če je ime pravilno, se morda splača preveriti tudi, če se nisi zatipkal kje drugje,