diff options
author | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-09 20:32:53 +0100 |
---|---|---|
committer | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-09 20:32:53 +0100 |
commit | d1565072c4d1eefcaf294bebfdb9ce1a3d299485 (patch) | |
tree | 72cdf032dd01e1085446669150eff0e02fe70ca1 /prolog/problems/lists/del_3/common.py | |
parent | 4fd77108854d7e83ce2d7135ed02b65ba73fc9e9 (diff) |
Hints for del/3 updated.
Diffstat (limited to 'prolog/problems/lists/del_3/common.py')
-rw-r--r-- | prolog/problems/lists/del_3/common.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/prolog/problems/lists/del_3/common.py b/prolog/problems/lists/del_3/common.py index 125ece1..65c51d1 100644 --- a/prolog/problems/lists/del_3/common.py +++ b/prolog/problems/lists/del_3/common.py @@ -28,6 +28,7 @@ hint_type = { 'del_from_empty_list_success': Hint('del_from_empty_list_success'), 'lost_heads': Hint('lost_heads'), 'recursive_case': Hint('recursive_case'), + 'leading_heads_all_x': Hint('leading_heads_all_x'), } test_cases = [ @@ -95,6 +96,10 @@ def hint(code, aux_code): if prolog.engine.ask_truth(engine_id, 'del(q, [a,b,c,d,q,x,y,z], [x,y,z])'): return [{'id': 'lost_heads'}] + # used [X|T] instead of more general [H|T] in recursive case + if prolog.engine.ask_truth(engine_id, 'del(q, [a,b,c,d,q,x,y,z], [x,y,z])'): + return [{'id': 'leading_heads_all_x'}] + # 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) |