summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/sister_2
diff options
context:
space:
mode:
authorMartin <martin@leo.fri1.uni-lj.si>2015-09-23 10:21:51 +0200
committerMartin <martin@leo.fri1.uni-lj.si>2015-09-23 10:21:51 +0200
commitbb366684ada98e140b1911c54d6c40fd911904cf (patch)
treee3b4f50ffd033d179c0c38d290ce33b7f99c800a /prolog/problems/family_relations/sister_2
parente0a5dd801c8382848b28503a81c141d0d15f5833 (diff)
parent76639241146ac5655ae04ea773ada420adb15295 (diff)
Merge branch 'master' of 192.168.15.97:codeq-problems
Diffstat (limited to 'prolog/problems/family_relations/sister_2')
-rw-r--r--prolog/problems/family_relations/sister_2/common.py12
-rw-r--r--prolog/problems/family_relations/sister_2/sl.py2
2 files changed, 6 insertions, 8 deletions
diff --git a/prolog/problems/family_relations/sister_2/common.py b/prolog/problems/family_relations/sister_2/common.py
index b3cbff0..6c48b00 100644
--- a/prolog/problems/family_relations/sister_2/common.py
+++ b/prolog/problems/family_relations/sister_2/common.py
@@ -24,7 +24,7 @@ sister(X, Y) :-
hint_type = {
'x_must_be_female': Hint('x_must_be_female'),
'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'),
}
@@ -118,15 +118,13 @@ def hint(program, solved_problems):
# this is an example of using the ordering of hints for easier trigger checks
if prolog.engine.ask_one(engine_id,
'sister(_, Y), male(Y)') == 'false':
- return [{'id': 'Y_can_be_of_any_gender'}]
+ return [{'id': 'y_can_be_of_any_gender'}]
# X and Y must be different
# this is the last code-specific hint (when everything else doesn't trigger anymore)
- ans = prolog.engine.ask_one(engine_id,
- 'setof(X, (member(X, [sally, nevia, vanessa]), sister(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, [sally, nevia, vanessa]), sister(X, X)), L), length(L, 3)'):
+ return [{'id': 'x_y_must_be_different'}]
# last hints are connected with programming style
# here, this means detecting such code:
diff --git a/prolog/problems/family_relations/sister_2/sl.py b/prolog/problems/family_relations/sister_2/sl.py
index aa66567..8c4c60f 100644
--- a/prolog/problems/family_relations/sister_2/sl.py
+++ b/prolog/problems/family_relations/sister_2/sl.py
@@ -37,7 +37,7 @@ hint = {
<p>Sestra je navadno ženskega spola.</p>
''',
- 'Y_can_be_of_any_gender': '''\
+ 'y_can_be_of_any_gender': '''\
<p><code>Y</code> je pravzaprav lahko poljubnega spola.</p>
''',