summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/brother_2
diff options
context:
space:
mode:
authorAleksander Sadikov <sasha@fri.uni-lj.si>2015-09-22 17:57:04 +0200
committerAleksander Sadikov <sasha@fri.uni-lj.si>2015-09-22 17:57:04 +0200
commitc50452d81b08d54b734f1da73b736bfbc2997215 (patch)
tree03c64486fb259b97fa7330849990dac76e14c74c /prolog/problems/family_relations/brother_2
parentcb71b2083b2f87b2f0466577dbe3e11efe22410c (diff)
New problems with hints for famrel section added.
This practically completes famrel section without some details.
Diffstat (limited to 'prolog/problems/family_relations/brother_2')
-rw-r--r--prolog/problems/family_relations/brother_2/common.py12
-rw-r--r--prolog/problems/family_relations/brother_2/sl.py2
2 files changed, 6 insertions, 8 deletions
diff --git a/prolog/problems/family_relations/brother_2/common.py b/prolog/problems/family_relations/brother_2/common.py
index 0df2d73..327e746 100644
--- a/prolog/problems/family_relations/brother_2/common.py
+++ b/prolog/problems/family_relations/brother_2/common.py
@@ -24,7 +24,7 @@ brother(X, Y) :-
hint_type = {
'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'),
+ 'y_can_be_of_any_gender': Hint('Y_can_be_of_any_gender'),
'x_y_must_be_different': Hint('x_y_must_be_different'),
}
@@ -87,14 +87,12 @@ def hint(program, solved_problems):
# Y can be of any gender, incl. female
if prolog.engine.ask_one(engine_id,
'brother(_, Y), female(Y)') == 'false':
- return [{'id': 'Y_can_be_of_any_gender'}]
+ return [{'id': 'y_can_be_of_any_gender'}]
# 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).')
- # TODO this barfs if ans is 'false'
- #if ans.get('N') == '3':
- # return [{'id': 'x_y_must_be_different'}]
+ if prolog.engine.ask_truth(engine_id,
+ 'setof(X, (member(X, [william, alessandro, andrew]), brother(X, X)), L), length(L, 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 116a968..2176bd8 100644
--- a/prolog/problems/family_relations/brother_2/sl.py
+++ b/prolog/problems/family_relations/brother_2/sl.py
@@ -38,7 +38,7 @@ hint = {
<p>Brat je navadno moškega spola.</p>
''',
- 'Y_can_be_of_any_gender': '''\
+ 'y_can_be_of_any_gender': '''\
<p><code>Y</code> je pravzaprav lahko poljubnega spola.</p>
''',