From 90dbc3fa624d62e093bea7b90a72a28ad216f7bd Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Mon, 29 Feb 2016 00:27:21 +0100 Subject: Additional improvements to hints for mother, father, grandparent, sister, and brother problems. --- prolog/problems/family_relations/father_2/common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'prolog/problems/family_relations/father_2') diff --git a/prolog/problems/family_relations/father_2/common.py b/prolog/problems/family_relations/father_2/common.py index 11f0742..31109c9 100644 --- a/prolog/problems/family_relations/father_2/common.py +++ b/prolog/problems/family_relations/father_2/common.py @@ -67,6 +67,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, 'father(_, _)'): + 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 @@ -102,10 +106,6 @@ def hint(code, aux_code): prolog.engine.ask_one(engine_id, 'father(_, 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, 'father(_, _)') == 'false': - return [{'id': 'predicate_always_false'}] - except socket.timeout as ex: pass -- cgit v1.2.1