diff options
author | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-14 16:44:55 +0100 |
---|---|---|
committer | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-14 16:44:55 +0100 |
commit | 0355f4ae1e1fa64a6855d3e19ec230c8a14aa5cf (patch) | |
tree | 443488c9a7ff75131ca942e9868807ab7e93d46c /prolog/problems/lists/divide_3 | |
parent | 820e032e90b31507c4084148a099a0a159e01583 (diff) |
Hints for divide/3 added.
Diffstat (limited to 'prolog/problems/lists/divide_3')
-rw-r--r-- | prolog/problems/lists/divide_3/common.py | 10 | ||||
-rw-r--r-- | prolog/problems/lists/divide_3/sl.py | 2 |
2 files changed, 6 insertions, 6 deletions
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 = ['''\ <p><img src="[%@resource plan.svg%]" /></p> -<p>Saj veš kako je šlo v osnovni šoli: prvi, drugi, prvi.../p> +<p>Saj veš kako je šlo v osnovni šoli: prvi, drugi, prvi, ...</p> ''', '''\ <p>Znaš vzeti dva elementa z začetka seznama? Vzorec je <code>[H1,H2|T]</code>.</p> ''', '''\ |