From 39dda4c1ad8bae96754b48b8ac14f3e21594f23c Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Mon, 14 Mar 2016 18:53:13 +0100 Subject: Hint for conc/3 corrected. --- prolog/problems/lists/conc_3/common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prolog/problems/lists/conc_3/common.py b/prolog/problems/lists/conc_3/common.py index 58152a6..108a334 100644 --- a/prolog/problems/lists/conc_3/common.py +++ b/prolog/problems/lists/conc_3/common.py @@ -82,6 +82,10 @@ def hint(code, aux_code): # recursion is getting bigger and bigger + # base case succeeds with arbitrary result + if prolog.engine.ask_truthTO(engine_id, 'conc([], [a,b,c], L), var(L)'): + return [{'id': 'base_case_arbitrary'}] + # shortening the second list instead of first list if prolog.engine.ask_truthTO(engine_id, 'conc([a,b,c], [1,2,3,4], L), (L = [1,2,3,4,a,b,c] ; L = [4,3,2,1,a,b,c])'): @@ -108,10 +112,6 @@ def hint(code, aux_code): return [{'id': 'two_heads_markup', 'start': m[0], 'end': m[1]} for m in marks] + \ [{'id': 'two_heads'}] - # base case succeeds with arbitrary result - if prolog.engine.ask_truthTO(engine_id, 'conc([], [a,b,c], L), var(L)'): - return [{'id': 'base_case_arbitrary'}] - # missing/failed base case if not prolog.engine.ask_one(engine_id, 'conc([], [qa,qb,qc], [qa,qb,qc])'): return [{'id': 'base_case'}] -- cgit v1.2.1