From 0355f4ae1e1fa64a6855d3e19ec230c8a14aa5cf Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Mon, 14 Mar 2016 16:44:55 +0100 Subject: Hints for divide/3 added. --- prolog/problems/lists/divide_3/common.py | 10 +++++----- prolog/problems/lists/divide_3/sl.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'prolog') diff --git a/prolog/problems/lists/divide_3/common.py b/prolog/problems/lists/divide_3/common.py index 34b7fe9..2d93c4c 100644 --- a/prolog/problems/lists/divide_3/common.py +++ b/prolog/problems/lists/divide_3/common.py @@ -88,7 +88,7 @@ def hint(code, aux_code): # forcing result onto recursion; case of divide(T, [H1|L1], [H2|L2]) if not prolog.engine.ask_truthTO(engine_id, 'divide([a,b,c], _, _)') and \ prolog.engine.ask_truthTO(engine_id, - 'asserta( divide([cob], [yowza,cob], [brix]) ), divide([yowza,brix,cob], [yowza,cob], [brix]), retract( divide([cob], [yowza,cob], [brix]) )'): + 'asserta( divide([cob], [yowza,cob], [brix]) ), divide([yowza,brix,cob], [cob], []), retract( divide([cob], [yowza,cob], [brix]) )'): return [{'id': 'forcing_result_onto_recursion'}] # base case succeeds with arbitrary result @@ -108,10 +108,10 @@ def hint(code, aux_code): if not prolog.engine.ask_truthTO(engine_id, 'divide([], [], [])'): return [{'id': 'base_case'}] - # target predicate seems to always be false - if not prolog.engine.ask_truthTO(engine_id, 'divide([_,_,_,_,_], _, _)') and \ - not prolog.engine.ask_truthTO(engine_id, 'divide([_,_,_,_,_,_], _, _)'): - return [{'id': 'predicate_always_false'}] +# # target predicate seems to always be false +# if not prolog.engine.ask_truthTO(engine_id, 'divide([_,_,_,_,_], _, _)') and \ +# not prolog.engine.ask_truthTO(engine_id, 'divide([_,_,_,_,_,_], _, _)'): +# return [{'id': 'predicate_always_false'}] # base cases work, the recursive doesn't (but it doesn't timeout) # this may be left as the last, most generic hint diff --git a/prolog/problems/lists/divide_3/sl.py b/prolog/problems/lists/divide_3/sl.py index 93bc699..3a9e5c2 100644 --- a/prolog/problems/lists/divide_3/sl.py +++ b/prolog/problems/lists/divide_3/sl.py @@ -14,7 +14,7 @@ description = '''\ plan = ['''\

-

Saj veš kako je šlo v osnovni šoli: prvi, drugi, prvi.../p> +

Saj veš kako je šlo v osnovni šoli: prvi, drugi, prvi, ...

''', '''\

Znaš vzeti dva elementa z začetka seznama? Vzorec je [H1,H2|T].

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