From 2fefd55550808f630190c89c6d9b3f6bfed3f164 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Thu, 1 Oct 2015 21:11:58 +0200 Subject: Figures and hints updated for mother/2, father/2, and grandparent/2 problems. --- prolog/problems/family_relations/grandparent_2/common.py | 7 +++++-- prolog/problems/family_relations/grandparent_2/sl.py | 13 +++++++++---- 2 files changed, 14 insertions(+), 6 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 078ed4e..e9df06b 100644 --- a/prolog/problems/family_relations/grandparent_2/common.py +++ b/prolog/problems/family_relations/grandparent_2/common.py @@ -21,7 +21,8 @@ grandparent(X, Y) :- hint_type = { 'no_common_z': Hint('no_common_z'), - 'gender_is_irrelevant': HintPopup('gender_is_irrelevant'), + 'gender_is_irrelevant_markup': HintPopup('gender_is_irrelevant_markup'), + 'gender_is_irrelevant': Hint('gender_is_irrelevant'), 'or_instead_of_and': Hint('or_instead_of_and'), 'x_must_be_parent': Hint('x_must_be_parent'), 'x_need_not_have_parent': Hint('x_need_not_have_parent'), @@ -86,7 +87,9 @@ def hint(program, solved_problems): # this is not necessarily wrong, but worth mentioning anyway targets = [prolog.util.Token('NAME', 'male'), prolog.util.Token('NAME', 'female')] marks = [(t.pos, t.pos + len(t.val)) for t in tokens if t in targets] - return [{'id': 'gender_is_irrelevant', 'start': m[0], 'end': m[1]} for m in marks] + if marks: + return [{'id': 'gender_is_irrelevant_markup', 'start': m[0], 'end': m[1]} for m in marks] + \ + [{'id': 'gender_is_irrelevant'}] # OR (;) instead of AND (,) # this hint has to be before the next two diff --git a/prolog/problems/family_relations/grandparent_2/sl.py b/prolog/problems/family_relations/grandparent_2/sl.py index a26d0b7..35ff49e 100644 --- a/prolog/problems/family_relations/grandparent_2/sl.py +++ b/prolog/problems/family_relations/grandparent_2/sl.py @@ -15,10 +15,9 @@ description = '''\ ''' plan = ['''\ -

-

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

+

Dedek ali babica ima otroka, ki ima otroka.

''', '''\ -

+

Dedek ali babica ima otroka, ki tudi sam ima otroka.

''', '''\

Če je X starš od starša od Y, potem je X stari starš od Y.

@@ -27,10 +26,14 @@ potem je X stari starš od Y.

hint = { 'no_common_z': '''\

Si povezal X in Y preko neke skupne (iste!) osebe?

-''', # TODO: Tim, tale namig.. nisem prepričan, da mi je všeč... (kako je izražen) +''', # TODO: Tim, tale namig.. nisem prepričan, da mi je všeč... (kako je izražen) -- morda nova slika!? 'gender_is_irrelevant': '''\

Iščemo starega starša in vnuka, spol pri tem ni pomemben.

+''', + + 'gender_is_irrelevant_markup': '''\ +

Je to res potrebno?

''', 'or_instead_of_and': '''\ @@ -39,6 +42,7 @@ hint = { 'x_must_be_parent': '''\

Dedek ali babica ima gotovo kakšnega otroka, kajne? Torej je starš od nekoga...

+

''', 'x_need_not_have_parent': '''\ @@ -47,6 +51,7 @@ hint = { 'y_must_have_parent': '''\

Vnuk Y mora imeti starša, kajne? Ta starš pa je...

+

''', 'y_need_not_be_parent': '''\ -- cgit v1.2.1