summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/ancestor_2
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/family_relations/ancestor_2')
-rw-r--r--prolog/problems/family_relations/ancestor_2/common.py5
-rw-r--r--prolog/problems/family_relations/ancestor_2/sl.py8
2 files changed, 13 insertions, 0 deletions
diff --git a/prolog/problems/family_relations/ancestor_2/common.py b/prolog/problems/family_relations/ancestor_2/common.py
index 2353eab..a7c491d 100644
--- a/prolog/problems/family_relations/ancestor_2/common.py
+++ b/prolog/problems/family_relations/ancestor_2/common.py
@@ -31,6 +31,7 @@ hint_type = {
'descendant_need_not_be_parent': Hint('descendant_need_not_be_parent'),
'wrong_direction': Hint('wrong_direction'),
'only_two_levels_deep': Hint('only_two_levels_deep'),
+ 'predicate_always_false': Hint('predicate_always_false'),
'timeout': Hint('timeout'),
}
@@ -84,6 +85,10 @@ def hint(code, aux_code):
return [{'id': 'grandparent_used_markup', 'start': m[0], 'end': m[1]} for m in marks] + \
[{'id': 'grandparent_used'}]
+ # target predicate seems to always be false
+ if not prolog.engine.ask_truthTO(engine_id, 'ancestor(_, _)'):
+ return [{'id': 'predicate_always_false'}]
+
# descendant instead of ancestor (wrong direction)
# warning: knowledge base dependent
if prolog.engine.ask_truthTO(engine_id,
diff --git a/prolog/problems/family_relations/ancestor_2/sl.py b/prolog/problems/family_relations/ancestor_2/sl.py
index 974bde3..de66ba4 100644
--- a/prolog/problems/family_relations/ancestor_2/sl.py
+++ b/prolog/problems/family_relations/ancestor_2/sl.py
@@ -80,6 +80,14 @@ npr. prababica ali prapradedek sta tudi prednika.</p>
<p><img src="[%@resource Prolog_ancestor_02.svg%]" /></p>
''',
+ '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> ali kaj podobnega).</p>
+''',
+
'timeout': '''\
<p>Je morda na delu potencialno neskončna rekurzija? Kako se bo ustavila?</p>
</p>Morda pa je kriv tudi manjkajoč, neustrezen ali preprosto nekompatibilen (s splošnim primerom) robni pogoj?</p>