summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/aunt_2
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/family_relations/aunt_2')
-rw-r--r--prolog/problems/family_relations/aunt_2/common.py9
-rw-r--r--prolog/problems/family_relations/aunt_2/sl.py8
2 files changed, 15 insertions, 2 deletions
diff --git a/prolog/problems/family_relations/aunt_2/common.py b/prolog/problems/family_relations/aunt_2/common.py
index e545000..d408041 100644
--- a/prolog/problems/family_relations/aunt_2/common.py
+++ b/prolog/problems/family_relations/aunt_2/common.py
@@ -33,6 +33,7 @@ hint_type = {
'aunt_vs_mother': Hint('aunt_vs_mother'),
'x_need_not_be_parent': Hint('x_need_not_be_parent'),
'y_need_not_be_parent': Hint('y_need_not_be_parent'),
+ 'predicate_always_false': Hint('predicate_always_false'),
}
test_cases = [
@@ -69,12 +70,16 @@ def hint(code, aux_code):
try:
engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
+ # target predicate seems to always be false
+ if not prolog.engine.ask_truth(engine_id, 'aunt(_, _)'):
+ return [{'id': 'predicate_always_false'}]
+
# X and Y mixed up
# warning: knowledge base dependent
# independent: match on findall(X/Y, (sister(Y, P), parent(P, X)), L)
if prolog.engine.ask_truth(engine_id,
- 'findall(X/Y, aunt(X, Y), \
- [vanessa/sally, patricia/sally, joanne/melanie, john/vanessa, susan/patricia])'):
+ 'setof(X/Y, aunt(X, Y), [alessandro/daniela, alessandro/luana, jeffrey/andrew, \
+ jeffrey/melanie, patricia/susan, vanessa/john, william/andrew, william/melanie])'):
return [{'id': 'x_and_y_mixed_up'}]
# precedence fail (AND block vs OR block)
diff --git a/prolog/problems/family_relations/aunt_2/sl.py b/prolog/problems/family_relations/aunt_2/sl.py
index 81014f4..15b6aec 100644
--- a/prolog/problems/family_relations/aunt_2/sl.py
+++ b/prolog/problems/family_relations/aunt_2/sl.py
@@ -70,5 +70,13 @@ Si morda pozabil, da teta in starš od <code>Y</code> ne smeta biti ista oseba?<
Teta je namreč sestra od starša od <code>Y</code>.</p>
<p><img src="[%@resource Prolog_aunt_07.svg%]" /></p>
''', # TODO: only trigger if sister is not part of correct solution
+
+ 'predicate_always_false': '''\
+<p>Vse kaže, da tvoj predikat vedno vrne "false". Si mu dal pravilno ime, si se morda pri imenu zatipkal?</p>
+<p>Če je ime pravilno, se morda splača preveriti tudi, če se nisi zatipkal kje drugje,
+je morda kakšna pika namesto vejice ali obratno, morda kakšna spremenljivka z malo začetnico?</p>
+<p>Možno je seveda tudi, da so tvoji pogoji prestrogi ali celo nemogoči (kot bi bila npr. zahteva,
+da je <code>X</code> hkrati starš in sestra od <code>Y</code>).</p>
+''',
}