summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations
diff options
context:
space:
mode:
authorAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-02-28 16:21:52 +0100
committerAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-02-28 16:21:52 +0100
commit74022caadc0b526c8f4224786a98aa7504ab035f (patch)
treeb93f477c8d8a1e87a633956951b151c158ca6c87 /prolog/problems/family_relations
parent05b57576d151a49a3c04b5e0817324baadc7bcf4 (diff)
grandparent/2 hints improved.
Diffstat (limited to 'prolog/problems/family_relations')
-rw-r--r--prolog/problems/family_relations/grandparent_2/common.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/prolog/problems/family_relations/grandparent_2/common.py b/prolog/problems/family_relations/grandparent_2/common.py
index 73c24e4..618ad28 100644
--- a/prolog/problems/family_relations/grandparent_2/common.py
+++ b/prolog/problems/family_relations/grandparent_2/common.py
@@ -79,7 +79,8 @@ def hint(code, aux_code):
# gender testing is redundant
# this is not necessarily wrong, but worth mentioning anyway
- targets = [prolog.util.Token('NAME', 'male'), prolog.util.Token('NAME', 'female')]
+ targets = [prolog.util.Token('NAME', 'male'), prolog.util.Token('NAME', 'female'),
+ prolog.util.Token('NAME', 'mother'), prolog.util.Token('NAME', 'father')]
marks = [(t.pos, t.pos + len(t.val)) for t in tokens if t in targets]
if marks:
return [{'id': 'gender_is_irrelevant_markup', 'start': m[0], 'end': m[1]} for m in marks] + \
@@ -110,13 +111,13 @@ def hint(code, aux_code):
return []
# X does not necessarily need to have a parent
- if prolog.engine.ask_one(engine_id,
- 'grandparent(X, _), \+ parent(_, X)') == 'false':
+ if prolog.engine.ask_truth(engine_id, 'grandparent(X, _)') and \
+ prolog.engine.ask_one(engine_id, 'grandparent(X, _), \+ parent(_, X)') == 'false':
return [{'id': 'x_need_not_have_parent'}]
# Y does not necessarily need to be a parent
- if prolog.engine.ask_one(engine_id,
- 'grandparent(_, Y), \+ parent(Y, _)') == 'false':
+ if prolog.engine.ask_truth(engine_id, 'grandparent(_, Y)') and \
+ prolog.engine.ask_one(engine_id, 'grandparent(_, Y), \+ parent(Y, _)') == 'false':
return [{'id': 'y_need_not_be_parent'}]
except socket.timeout as ex:
@@ -128,3 +129,7 @@ def hint(code, aux_code):
return []
+# sudo mount -o ro /dev/sdaX /mnt
+# things to discuss with Tim
+# * can we make predicate_always_false a ghint?
+# with this in mind: how can we supply/know the correct target name and arity?