From 913007d3f60d86c3f4e11733153233434da8607f Mon Sep 17 00:00:00 2001
From: Aleksander Sadikov
Date: Wed, 9 Mar 2016 19:48:21 +0100
Subject: Hints for del/3 updated.
---
prolog/problems/lists/del_3/common.py | 6 ++++++
prolog/problems/lists/del_3/sl.py | 4 ++++
2 files changed, 10 insertions(+)
(limited to 'prolog')
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
@@ -46,6 +46,10 @@ implicitno že kar v argumentih predikata (glavi stavka).
'base_case': '''\
Si pomislil na robni pogoj? Kaj je najbolj enostaven primer, kateri element v seznamu najlažje zbrišeš?
+''',
+
+ 'recursive_case': '''\
+Robni primer deluje. Kaj pa rekurzivni, splošni, primer?
''',
'predicate_always_false': '''\
--
cgit v1.2.1