diff options
Diffstat (limited to 'prolog/problems/family_relations/grandparent_2')
-rw-r--r-- | prolog/problems/family_relations/grandparent_2/common.py | 15 |
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? |