summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/mother_2/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/family_relations/mother_2/common.py')
-rw-r--r--prolog/problems/family_relations/mother_2/common.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/prolog/problems/family_relations/mother_2/common.py b/prolog/problems/family_relations/mother_2/common.py
index 1bb7a4b..a7da458 100644
--- a/prolog/problems/family_relations/mother_2/common.py
+++ b/prolog/problems/family_relations/mother_2/common.py
@@ -68,6 +68,10 @@ def hint(code, aux_code):
try:
engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
+ # target predicate seems to always be false
+ if not prolog.engine.ask_truth(engine_id, 'mother(_, _)'):
+ return [{'id': 'predicate_always_false'}]
+
# OR (;) instead of AND (,)
# this hint has to be before the next two
# as otherwise those two would always override it
@@ -103,10 +107,6 @@ def hint(code, aux_code):
prolog.engine.ask_one(engine_id, 'mother(_, 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, 'mother(_, _)') == 'false':
- return [{'id': 'predicate_always_false'}]
-
except socket.timeout as ex:
pass