summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/brother_2
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/family_relations/brother_2')
-rw-r--r--prolog/problems/family_relations/brother_2/common.py25
-rw-r--r--prolog/problems/family_relations/brother_2/sl.py12
2 files changed, 20 insertions, 17 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
diff --git a/prolog/problems/family_relations/brother_2/sl.py b/prolog/problems/family_relations/brother_2/sl.py
index f9db389..ad1d6c2 100644
--- a/prolog/problems/family_relations/brother_2/sl.py
+++ b/prolog/problems/family_relations/brother_2/sl.py
@@ -13,22 +13,18 @@ description = '''\
</pre>'''
hint = {
- 'general_hint_1': '''\
+ 'general_hint': ['''\
<p><img src="Sister-1.png" /></p>
-''',
-
- 'general_hint_2': '''\
+''', '''\
<p><img src="Sister-2.png" /></p>
-''',
-
- 'general_hint_3': '''\
+''', '''\
<p><img src="Sister-2.png" /></p>
<pre>
parent(P, X)
parent(P, Y)
male(X)
</pre>
-''',
+'''],
'x_y_must_be_different': '''\
<p>Si pomislil, da sta <code>X</code> in <code>Y</code> lahko ista oseba? Poskusi naslednjo poizvedbo:</p>