summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/aunt_2/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/family_relations/aunt_2/common.py')
-rw-r--r--prolog/problems/family_relations/aunt_2/common.py7
1 files changed, 7 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,