From 436956e015a62557c522e56265fb0351463cd419 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Mon, 14 Mar 2016 18:29:12 +0100 Subject: Hints for permute/2 updated. --- prolog/problems/lists/permute_2/common.py | 6 +++++- prolog/problems/lists/permute_2/sl.py | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'prolog/problems') 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 @@ -67,6 +67,11 @@ narediti ti z rezultatom, ki ga rekurzija vrne. Skratka, element H 'recursive_case': '''\

Robni primer deluje. Kaj pa rekurzivni, splošni, primer?

+''', + + 'no_insert_or_delete': '''\ +

Robni primer deluje. Kaj pa rekurzivni, splošni, primer? Morda se ti splača uporabiti kakšno že rešeno +nalogo s seznami?

''', 'predicate_always_false': '''\ -- cgit v1.2.1