summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/family_relations')
-rw-r--r--prolog/problems/family_relations/grandparent_2/common.py8
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