From 73b899272899bc30f92e0032f96cc3f40c7925a7 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Mon, 29 Feb 2016 00:38:16 +0100 Subject: Additional improvements to hints for mother, father, grandparent, sister, and brother problems. --- prolog/problems/family_relations/sister_2/common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'prolog/problems/family_relations/sister_2') diff --git a/prolog/problems/family_relations/sister_2/common.py b/prolog/problems/family_relations/sister_2/common.py index 2be3ab3..8493007 100644 --- a/prolog/problems/family_relations/sister_2/common.py +++ b/prolog/problems/family_relations/sister_2/common.py @@ -91,6 +91,10 @@ def hint(code, aux_code): try: engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) + # use of \= or =\= instead of \== + if prolog.util.Token('NEQU', '\=') in tokens or prolog.util.Token('NEQA', '=\=') in tokens: + return [{'id': 'neq+_instead_of_neq'}] + # target predicate seems to always be false if not prolog.engine.ask_truth(engine_id, 'sister(_, _)'): return [{'id': 'predicate_always_false'}] @@ -112,10 +116,6 @@ def hint(code, aux_code): prolog.engine.ask_one(engine_id, 'sister(_, Y), male(Y)') == 'false': return [{'id': 'y_can_be_of_any_gender'}] - # use of \= or =\= instead of \== - if prolog.util.Token('NEQU', '\=') in tokens or prolog.util.Token('NEQA', '=\=') in tokens: - return [{'id': 'neq+_instead_of_neq'}] - # X and Y must be different # this is the last code-specific hint (when everything else doesn't trigger anymore) if prolog.util.Token('NEQ', '\==') not in tokens and prolog.engine.ask_truth(engine_id, -- cgit v1.2.1