summaryrefslogtreecommitdiff
path: root/prolog/problems/lists/del_3/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/lists/del_3/common.py')
-rw-r--r--prolog/problems/lists/del_3/common.py6
1 files changed, 6 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'}]