From 1b64321fda0bbf1f5a678671c1344eb2b87b5c74 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 10 Sep 2015 22:29:24 +0200 Subject: Use Hint classes for hints from the last commit Also move the language-specific hint method for Prolog to prolog.common. --- prolog/problems/family_relations/mother_2/common.py | 20 ++++++++++++++------ prolog/problems/family_relations/mother_2/sl.py | 12 ++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'prolog/problems/family_relations/mother_2') diff --git a/prolog/problems/family_relations/mother_2/common.py b/prolog/problems/family_relations/mother_2/common.py index 613b721..09a641a 100644 --- a/prolog/problems/family_relations/mother_2/common.py +++ b/prolog/problems/family_relations/mother_2/common.py @@ -1,5 +1,11 @@ # coding=utf-8 +import socket +import prolog.engine +import prolog.util +from server.hints import Hint, HintSequence +import server.problems + id = 94 group = 'family_relations' number = 1 @@ -12,9 +18,14 @@ mother(X, Y) :- female(X). ''' -import prolog.engine -import prolog.util -import server.problems +hint_defs = { + 'general_hint': HintSequence('general_hint', 3), + 'or_instead_of_and': Hint('or_instead_of_and'), + 'x_must_be_female': Hint('x_must_be_female'), + 'x_must_be_parent': Hint('x_must_be_parent'), + 'y_can_be_of_any_gender': Hint('y_can_be_of_any_gender'), + 'y_need_not_be_parent': Hint('y_need_not_be_parent'), +} def test(session, program): # TODO: change queries and answers (these are for sister/2) @@ -46,9 +57,6 @@ def test(session, program): return n_correct, len(queries) -def general_hint(): - pass - def hint(session, program): tokens = prolog.util.tokenize(program) diff --git a/prolog/problems/family_relations/mother_2/sl.py b/prolog/problems/family_relations/mother_2/sl.py index 8923eb5..5922d6c 100644 --- a/prolog/problems/family_relations/mother_2/sl.py +++ b/prolog/problems/family_relations/mother_2/sl.py @@ -15,19 +15,15 @@ description = '''\ ''' hint = { - 'general_hint_1': '''\ + 'general_hint': ['''\

Loni naj zbriše imena relacij (parent, mother) s te slike!

-''', - - 'general_hint_2': '''\ +''', '''\

-''', - - 'general_hint_3': '''\ +''', '''\

Če je X ženska in je hkrati X starš od Y, potem je X mama od Y.

-''', +'''], 'or_instead_of_and': '''\

Si morda uporabil podpičje (ki pomeni ALI) namesto vejice (ki pomeni IN)?

-- cgit v1.2.1