diff options
-rw-r--r-- | prolog/problems/family_relations/grandparent_2/common.py | 17 | ||||
-rw-r--r-- | prolog/problems/family_relations/mother_2/Mother-1.png | bin | 0 -> 40513 bytes | |||
-rw-r--r-- | prolog/problems/family_relations/mother_2/Mother-2.png | bin | 0 -> 36521 bytes | |||
-rw-r--r-- | prolog/problems/family_relations/mother_2/Mother-3.png | bin | 0 -> 38712 bytes | |||
-rw-r--r-- | prolog/problems/family_relations/mother_2/sl.py | 8 |
5 files changed, 15 insertions, 10 deletions
diff --git a/prolog/problems/family_relations/grandparent_2/common.py b/prolog/problems/family_relations/grandparent_2/common.py index 98e40fc..8ccd23d 100644 --- a/prolog/problems/family_relations/grandparent_2/common.py +++ b/prolog/problems/family_relations/grandparent_2/common.py @@ -103,16 +103,21 @@ def hint(program, solved_problems): 'grandparent(X, _), \+ parent(X, _)'): return [{'id': 'x_must_be_parent'}] - # X does not necessarily need to have a parent - if prolog.engine.ask_one(engine_id, - 'grandparent(X, _), \+ parent(_, X)') == 'false': - return [{'id': 'x_need_not_have_parent'}] - # Y must have a parent if prolog.engine.ask_truth(engine_id, 'grandparent(_, Y), \+ parent(_, Y)'): return [{'id': 'y_must_have_parent'}] + # stop further hint testing if target predicate is always true or always false + if prolog.engine.ask_truth(engine_id, + '\+ grandparent(_, _) ; findall(X/Y, grandparent(X, Y), [A/B]), var(A), var(B)'): + return [] + + # X does not necessarily need to have a parent + if prolog.engine.ask_one(engine_id, + 'grandparent(X, _), \+ parent(_, X)') == 'false': + return [{'id': 'x_need_not_have_parent'}] + # Y does not necessarily need to be a parent if prolog.engine.ask_one(engine_id, 'grandparent(_, Y), \+ parent(Y, _)') == 'false': @@ -125,5 +130,5 @@ def hint(program, solved_problems): if engine_id: prolog.engine.destroy(engine_id) - return None + return [] diff --git a/prolog/problems/family_relations/mother_2/Mother-1.png b/prolog/problems/family_relations/mother_2/Mother-1.png Binary files differnew file mode 100644 index 0000000..239b54f --- /dev/null +++ b/prolog/problems/family_relations/mother_2/Mother-1.png diff --git a/prolog/problems/family_relations/mother_2/Mother-2.png b/prolog/problems/family_relations/mother_2/Mother-2.png Binary files differnew file mode 100644 index 0000000..e0179e4 --- /dev/null +++ b/prolog/problems/family_relations/mother_2/Mother-2.png diff --git a/prolog/problems/family_relations/mother_2/Mother-3.png b/prolog/problems/family_relations/mother_2/Mother-3.png Binary files differnew file mode 100644 index 0000000..e0ea5c1 --- /dev/null +++ b/prolog/problems/family_relations/mother_2/Mother-3.png diff --git a/prolog/problems/family_relations/mother_2/sl.py b/prolog/problems/family_relations/mother_2/sl.py index 3494096..bd4d57e 100644 --- a/prolog/problems/family_relations/mother_2/sl.py +++ b/prolog/problems/family_relations/mother_2/sl.py @@ -16,10 +16,10 @@ description = '''\ plan = [ '''\ -<p><img src="Mother-1.png" /></p> +<p><img src="[%@resource Mother-1.png%]" alt="Mama ima otroka in je ženskega spola." /></p> <p>Loni naj zbriše imena relacij (parent, mother) s te slike!</p>''', '''\ -<p><img src="Mother-1.png" /></p>''', +<p><img src="[%@resource Mother-1.png%]" alt="Mama X je starš od Y in je ženskega spola." /></p>''', '''\ <p>Če je <code>X</code> ženska in je hkrati <code>X</code> starš od <code>Y</code>, potem je <code>X</code> mama od <code>Y</code>.</p>''' @@ -32,12 +32,12 @@ hint = { 'x_must_be_female': '''\ <p>Mama je navadno ženskega spola.</p> -<p><img src="Mother-2.png" /></p> +<p><img src="[%@resource Mother-2.png%]" /></p> ''', 'x_must_be_parent': '''\ <p>Mama naj bi imela vsaj enega otroka... torej je starš od nekoga.</p> -<p><img src="Mother-3.png" /></p> +<p><img src="[%@resource Mother-3.png%]" /></p> ''', 'y_can_be_of_any_gender': '''\ |