diff options
author | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-14 18:29:12 +0100 |
---|---|---|
committer | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-14 18:29:12 +0100 |
commit | 436956e015a62557c522e56265fb0351463cd419 (patch) | |
tree | 121d31bd5469cf66b2ea1f8a3647795281199bb8 /prolog/problems/lists/permute_2 | |
parent | f1864286a587cab27dfc40651837c47d087da827 (diff) |
Hints for permute/2 updated.
Diffstat (limited to 'prolog/problems/lists/permute_2')
-rw-r--r-- | prolog/problems/lists/permute_2/common.py | 6 | ||||
-rw-r--r-- | prolog/problems/lists/permute_2/sl.py | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/prolog/problems/lists/permute_2/common.py b/prolog/problems/lists/permute_2/common.py index 55c2b48..cbd46d5 100644 --- a/prolog/problems/lists/permute_2/common.py +++ b/prolog/problems/lists/permute_2/common.py @@ -28,6 +28,7 @@ hint_type = { 'predicate_always_false': Hint('predicate_always_false'), 'base_case': Hint('base_case'), 'recursive_case': Hint('recursive_case'), + 'no_insert_or_delete': Hint('no_insert_or_delete'), 'timeout': Hint('timeout'), 'base_case_arbitrary': Hint('base_case_arbitrary'), 'unsuccessful_conc_use': Hint('unsuccessful_conc_use'), @@ -105,7 +106,10 @@ def hint(code, aux_code): # base cases work, 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, 'permute([qa,qb], [qb,qa])'): - return [{'id': 'recursive_case'}] + if prolog.util.Token('NAME', 'insert') in tokens or prolog.util.Token('NAME', 'del') in tokens: + return [{'id': 'recursive_case'}] + else: + return [{'id': 'no_insert_or_delete'}] except socket.timeout as ex: return [{'id': 'timeout'}] diff --git a/prolog/problems/lists/permute_2/sl.py b/prolog/problems/lists/permute_2/sl.py index 8472cab..5e347e4 100644 --- a/prolog/problems/lists/permute_2/sl.py +++ b/prolog/problems/lists/permute_2/sl.py @@ -69,6 +69,11 @@ narediti ti z rezultatom, ki ga rekurzija vrne. Skratka, element <code>H</code> <p>Robni primer deluje. Kaj pa rekurzivni, splošni, primer?</p> ''', + 'no_insert_or_delete': '''\ +<p>Robni primer deluje. Kaj pa rekurzivni, splošni, primer? Morda se ti splača uporabiti kakšno že rešeno +nalogo s seznami?</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, |