diff options
author | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-02-29 00:19:33 +0100 |
---|---|---|
committer | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-02-29 00:19:33 +0100 |
commit | 0891683712b8f4206a83c200e6ad3df283a64a75 (patch) | |
tree | 958f92c147b67e9e399e791d341cad0f75605595 /prolog/problems/family_relations/grandparent_2 | |
parent | 49a2f24a813ca250d1c1f31f9799661ff70615ed (diff) |
Additional improvements to hints for mother, father, grandparent, sister, and brother problems.
Diffstat (limited to 'prolog/problems/family_relations/grandparent_2')
-rw-r--r-- | prolog/problems/family_relations/grandparent_2/common.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/prolog/problems/family_relations/grandparent_2/common.py b/prolog/problems/family_relations/grandparent_2/common.py index 870ceb1..431071e 100644 --- a/prolog/problems/family_relations/grandparent_2/common.py +++ b/prolog/problems/family_relations/grandparent_2/common.py @@ -71,6 +71,10 @@ def hint(code, aux_code): # TODO: generic hint for: # TODO: parent(X, Z1), parent(Z2, Y), Z1 = Z2 + # target predicate seems to always be false + if not prolog.engine.ask_truth(engine_id, 'grandparent(_, _)'): + return [{'id': 'predicate_always_false'}] + # broken "link" mistake -- no common parent/child Z # warning: due to speed considerations this (1024) is knowledge base dependent # independent: findall(_, (parent(X, Z1), parent(Z2, Y)), L) @@ -121,10 +125,6 @@ def hint(code, aux_code): prolog.engine.ask_one(engine_id, 'grandparent(_, Y), \+ parent(Y, _)') == 'false': return [{'id': 'y_need_not_be_parent'}] - # target predicate seems to always be false - if prolog.engine.ask_one(engine_id, 'grandparent(_, _)') == 'false': - return [{'id': 'predicate_always_false'}] - except socket.timeout as ex: pass |