summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/brother_2/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/family_relations/brother_2/common.py')
-rw-r--r--prolog/problems/family_relations/brother_2/common.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/prolog/problems/family_relations/brother_2/common.py b/prolog/problems/family_relations/brother_2/common.py
index 41512e6..f2bfa15 100644
--- a/prolog/problems/family_relations/brother_2/common.py
+++ b/prolog/problems/family_relations/brother_2/common.py
@@ -1,5 +1,11 @@
# coding=utf-8
+import socket
+import prolog.engine
+import prolog.util
+from server.hints import Hint, HintSequence
+import server.problems
+
id = 97
group = 'family_relations'
number = 4
@@ -14,10 +20,13 @@ brother(X, Y) :-
X \== Y.
'''
-import prolog.engine
-import prolog.util
-import server.problems
-import socket
+hint_defs = {
+ 'general_hint': HintSequence('general_hint', 3),
+ 'x_must_be_male': Hint('x_must_be_male'),
+ 'common_parent_needed': Hint('common_parent_needed'),
+ 'Y_can_be_of_any_gender': Hint('Y_can_be_of_any_gender'),
+ 'x_y_must_be_different': Hint('x_y_must_be_different'),
+}
def test(session, program):
# TODO: change queries and answers (these are for sister/2)
@@ -49,9 +58,6 @@ def test(session, program):
return n_correct, len(queries)
-def general_hint():
- pass
-
def hint(session, program):
# tokens = prolog.util.tokenize(program)
@@ -79,8 +85,9 @@ def hint(session, program):
# X and Y must be different
ans = prolog.engine.ask_one(engine_id,
'setof(X, (member(X, [william, alessandro, andrew]), brother(X, X)), L), length(L, N).')
- if ans.get('N') == '3':
- return [{'id': 'x_y_must_be_different'}]
+ # TODO this barfs if ans is 'false'
+ #if ans.get('N') == '3':
+ # return [{'id': 'x_y_must_be_different'}]
except socket.timeout as ex:
pass