diff options
author | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-28 17:15:24 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-28 17:15:24 +0200 |
commit | 6306f811c7d8a0cd893a0ad1fbcae9e701de3c64 (patch) | |
tree | 2eab4b7bc90ad4fd568d06c720c0c182e3c17f25 /prolog | |
parent | 218bdd734d6b61fd7343d88b8d983da337821a5d (diff) |
Add a simple hint function for sister_2
Diffstat (limited to 'prolog')
-rw-r--r-- | prolog/problems/family_relations/sister_2/common.py | 5 | ||||
-rw-r--r-- | prolog/problems/family_relations/sister_2/en.py | 23 |
2 files changed, 27 insertions, 1 deletions
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. </pre>''' -hint = {} +hint = { + 'x_y_must_be_different': '''\ +<p>What if <code>X</code> and <code>Y</code> are the same person? Try the +following query:</p> +<pre> +?- sister(sally, Y). +</pre> +''', + + # TODO move to generic prolog/en.py + 'no_hint': '''\ +<p>No hint available, sorry! Try to use thinking instead.</p> +''', + + # TODO move to generic prolog/en.py + 'syntax_error': '''\ +<p>Your code contains syntactic mistakes. The Prolog compiler emitted the following messages:</p> +<pre> +[%=messages%] +</pre> +''', +} |