summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/brother_2
diff options
context:
space:
mode:
authorAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-02-29 00:38:16 +0100
committerAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-02-29 00:38:16 +0100
commit73b899272899bc30f92e0032f96cc3f40c7925a7 (patch)
tree8a4428a1ea828e248575e506236e78060753526a /prolog/problems/family_relations/brother_2
parent90dbc3fa624d62e093bea7b90a72a28ad216f7bd (diff)
Additional improvements to hints for mother, father, grandparent, sister, and brother problems.
Diffstat (limited to 'prolog/problems/family_relations/brother_2')
-rw-r--r--prolog/problems/family_relations/brother_2/common.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/prolog/problems/family_relations/brother_2/common.py b/prolog/problems/family_relations/brother_2/common.py
index 87f27a3..8046b32 100644
--- a/prolog/problems/family_relations/brother_2/common.py
+++ b/prolog/problems/family_relations/brother_2/common.py
@@ -65,6 +65,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, 'brother(_, _)'):
return [{'id': 'predicate_always_false'}]
@@ -83,10 +87,6 @@ def hint(code, aux_code):
prolog.engine.ask_one(engine_id, 'brother(_, Y), female(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
if prolog.util.Token('NEQ', '\==') not in tokens and prolog.engine.ask_truth(engine_id,
'setof(X, (member(X, [william, alessandro, andrew]), brother(X, X)), L), length(L, 3)'):