diff options
author | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-02 15:24:00 +0100 |
---|---|---|
committer | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-02 15:24:00 +0100 |
commit | d4e24f31ab51640c2e65eb68446f0d5f6174b7e1 (patch) | |
tree | 6fd93eaa6cca34c30ea97a1cee5ef29507b3c442 /prolog/problems/family_relations/descendant_2 | |
parent | e318ce671052e30dff8077d7ca72f8633cab9ffa (diff) |
Improved hints for ancestor/2 and descendant/2.
Diffstat (limited to 'prolog/problems/family_relations/descendant_2')
-rw-r--r-- | prolog/problems/family_relations/descendant_2/common.py | 5 | ||||
-rw-r--r-- | prolog/problems/family_relations/descendant_2/sl.py | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/prolog/problems/family_relations/descendant_2/common.py b/prolog/problems/family_relations/descendant_2/common.py index b4d8f31..6cfe1cd 100644 --- a/prolog/problems/family_relations/descendant_2/common.py +++ b/prolog/problems/family_relations/descendant_2/common.py @@ -30,6 +30,7 @@ hint_type = { 'descendant_of_oneself_with_or': Hint('descendant_of_oneself_with_or'), 'descendant_need_not_be_parent': Hint('descendant_need_not_be_parent'), 'wrong_direction': Hint('wrong_direction'), + 'predicate_always_false': Hint('predicate_always_false'), 'timeout': Hint('timeout'), 'final_hint': Hint('final_hint'), } @@ -88,6 +89,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, 'descendant(_, _)'): + return [{'id': 'predicate_always_false'}] + # ancestor instead of descendant (wrong direction) # warning: knowledge base dependent if prolog.engine.ask_truthTO(engine_id, diff --git a/prolog/problems/family_relations/descendant_2/sl.py b/prolog/problems/family_relations/descendant_2/sl.py index 9f1d818..c53c8b9 100644 --- a/prolog/problems/family_relations/descendant_2/sl.py +++ b/prolog/problems/family_relations/descendant_2/sl.py @@ -70,6 +70,14 @@ Premisli, morda se ti splača tudi grafično skicirati tvojo trenutno rešitev.< <p>Potomec <code>X</code> pravzaprav ne rabi imeti otrok...</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> |