diff options
Diffstat (limited to 'prolog/problems/lists')
-rw-r--r-- | prolog/problems/lists/del_3/common.py | 6 | ||||
-rw-r--r-- | prolog/problems/lists/del_3/sl.py | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/prolog/problems/lists/del_3/common.py b/prolog/problems/lists/del_3/common.py index f3dfcb2..c984fef 100644 --- a/prolog/problems/lists/del_3/common.py +++ b/prolog/problems/lists/del_3/common.py @@ -27,6 +27,7 @@ hint_type = { 'final_hint': Hint('final_hint'), 'del_from_empty_list_success': Hint('del_from_empty_list_success'), 'lost_heads': Hint('lost_heads'), + 'recursive_case': Hint('recursive_case'), } test_cases = [ @@ -97,6 +98,11 @@ def hint(code, aux_code): # L=[H|T] at the end of the rule; this can be detected with test cases and can be wrong (in some sense) # TODO: implement it, and provide a good explanation (might be hard) + # base case works, the recursive doesn't (but it doesn't timeout) + # this may be left as the last, most generic hint + if not prolog.engine.ask_truth(engine_id, 'del(qQ, [qa,qb,qQ,qc], [qa,qb,qc])'): + return [{'id': 'recursive_case'}] + except socket.timeout as ex: return [{'id': 'timeout'}] diff --git a/prolog/problems/lists/del_3/sl.py b/prolog/problems/lists/del_3/sl.py index 5fa8e17..0875fe0 100644 --- a/prolog/problems/lists/del_3/sl.py +++ b/prolog/problems/lists/del_3/sl.py @@ -48,6 +48,10 @@ implicitno že kar v argumentih predikata (glavi stavka).</p> <p>Si pomislil na robni pogoj? Kaj je najbolj enostaven primer, kateri element v seznamu najlažje zbrišeš?</p> ''', + 'recursive_case': '''\ +<p>Robni primer deluje. Kaj pa rekurzivni, splošni, primer?</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, |