From 6306f811c7d8a0cd893a0ad1fbcae9e701de3c64 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 28 Aug 2015 17:15:24 +0200 Subject: Add a simple hint function for sister_2 --- .../problems/family_relations/sister_2/common.py | 5 +++++ prolog/problems/family_relations/sister_2/en.py | 23 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'prolog') diff --git a/prolog/problems/family_relations/sister_2/common.py b/prolog/problems/family_relations/sister_2/common.py index 2c9528e..9be9e6d 100644 --- a/prolog/problems/family_relations/sister_2/common.py +++ b/prolog/problems/family_relations/sister_2/common.py @@ -45,3 +45,8 @@ def test(program): prolog.engine.destroy(engine_id) return n_correct, len(queries) + +def hint(program): + if '\=' not in program and '\==' not in program: + return [{'id': 'x_y_must_be_different'}] + return None diff --git a/prolog/problems/family_relations/sister_2/en.py b/prolog/problems/family_relations/sister_2/en.py index d8395c0..629123c 100644 --- a/prolog/problems/family_relations/sister_2/en.py +++ b/prolog/problems/family_relations/sister_2/en.py @@ -11,4 +11,25 @@ description = '''\ X = patricia. ''' -hint = {} +hint = { + 'x_y_must_be_different': '''\ +

What if X and Y are the same person? Try the +following query:

+
+?- sister(sally, Y).
+
+''', + + # TODO move to generic prolog/en.py + 'no_hint': '''\ +

No hint available, sorry! Try to use thinking instead.

+''', + + # TODO move to generic prolog/en.py + 'syntax_error': '''\ +

Your code contains syntactic mistakes. The Prolog compiler emitted the following messages:

+
+[%=messages%]
+
+''', +} -- cgit v1.2.1