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/father_2/common.py | 21 ++++++++++++++++----- prolog/problems/family_relations/father_2/en.py | 2 +- prolog/problems/family_relations/father_2/sl.py | 21 +++++++++------------ 3 files changed, 26 insertions(+), 18 deletions(-) (limited to 'prolog/problems/family_relations/father_2') diff --git a/prolog/problems/family_relations/father_2/common.py b/prolog/problems/family_relations/father_2/common.py index e1b46fd..81191d3 100644 --- a/prolog/problems/family_relations/father_2/common.py +++ b/prolog/problems/family_relations/father_2/common.py @@ -1,8 +1,14 @@ # coding=utf-8 -id = 999 # TODO: new id has to be defined for this problem +import socket +import prolog.engine +import prolog.util +from server.hints import Hint, HintSequence +import server.problems + +id = 181 group = 'family_relations' -number = 999 # TODO: this should be problem #2 +number = 2 visible = True facts = 'family_relations' @@ -12,9 +18,14 @@ father(X, Y) :- male(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_male': Hint('x_must_be_male'), + '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) diff --git a/prolog/problems/family_relations/father_2/en.py b/prolog/problems/family_relations/father_2/en.py index 108bb9b..59857a8 100644 --- a/prolog/problems/family_relations/father_2/en.py +++ b/prolog/problems/family_relations/father_2/en.py @@ -1,6 +1,6 @@ # coding=utf-8 -id = 94 +id = 181 name = 'mother/2' slug = 'the mother-child relation' diff --git a/prolog/problems/family_relations/father_2/sl.py b/prolog/problems/family_relations/father_2/sl.py index c9c38b7..8fb66c5 100644 --- a/prolog/problems/family_relations/father_2/sl.py +++ b/prolog/problems/family_relations/father_2/sl.py @@ -1,11 +1,12 @@ # coding=utf-8 -id = 94 -name = 'mother/2' -slug = 'X je mama od Y' +id = 181 +name = 'father/2' +slug = 'X je oče od Y' +# TODO fix example description = '''\ -

mother(X, Y): X je mama od Y.

+

father(X, Y): X je oče od Y.

   ?- mother(tina, william).
     true.
@@ -15,19 +16,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