From 49a2f24a813ca250d1c1f31f9799661ff70615ed Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Mon, 29 Feb 2016 00:11:26 +0100 Subject: Additional improvements to hints for mother, father, grandparent, sister, and brother problems. --- prolog/problems/family_relations/grandparent_2/common.py | 14 ++++++++++---- prolog/problems/family_relations/grandparent_2/sl.py | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'prolog/problems/family_relations/grandparent_2') diff --git a/prolog/problems/family_relations/grandparent_2/common.py b/prolog/problems/family_relations/grandparent_2/common.py index 45273c6..870ceb1 100644 --- a/prolog/problems/family_relations/grandparent_2/common.py +++ b/prolog/problems/family_relations/grandparent_2/common.py @@ -27,6 +27,7 @@ hint_type = { 'x_need_not_have_parent': Hint('x_need_not_have_parent'), 'y_must_have_parent': Hint('y_must_have_parent'), 'y_need_not_be_parent': Hint('y_need_not_be_parent'), + 'predicate_always_false': Hint('predicate_always_false'), } test_cases = [ @@ -120,6 +121,10 @@ def hint(code, aux_code): prolog.engine.ask_one(engine_id, 'grandparent(_, Y), \+ parent(Y, _)') == 'false': return [{'id': 'y_need_not_be_parent'}] + # target predicate seems to always be false + if prolog.engine.ask_one(engine_id, 'grandparent(_, _)') == 'false': + return [{'id': 'predicate_always_false'}] + except socket.timeout as ex: pass @@ -131,7 +136,8 @@ def hint(code, aux_code): # sudo mount -o ro /dev/sdaX /mnt # things to discuss with Tim -# * can we make predicate_always_false a ghint? -# with this in mind: how can we supply/know the correct target name and arity? -# * popraviti je potrebno spremni tekst glede na novo lokacijo gumba Namig -# * what's the name of \= token? And what of =\= token? +# 1o can we make predicate_always_false a ghint? +# with this in mind: how can we supply/know the correct target name and arity? +# 2x popraviti je potrebno spremni tekst glede na novo lokacijo gumba Namig +# 3 what's the name of \= token? And what of =\= token? +# 4 final hint! This very much improves the user experience, adds knowledge, therefore needs to be implemented now! diff --git a/prolog/problems/family_relations/grandparent_2/sl.py b/prolog/problems/family_relations/grandparent_2/sl.py index 2961ffa..549d7cc 100644 --- a/prolog/problems/family_relations/grandparent_2/sl.py +++ b/prolog/problems/family_relations/grandparent_2/sl.py @@ -60,5 +60,11 @@ hint = { 'y_need_not_be_parent': '''\

Vnuk Y pravzaprav ne rabi imeti otrok, da ima dedka ali babico...

+''', + + 'predicate_always_false': '''\ +

Vse kaže, da tvoj predikat vedno vrne "false". Si mu dal pravilno ime, si se morda pri imenu zatipkal?

+

Če je ime pravilno, se morda splača preveriti tudi, če se nisi zatipkal kje drugje, +je morda kakšna pika namesto vejice ali obratno, morda kakšna spremenljivka z malo začetnico?

''', } -- cgit v1.2.1