From 6bda47fb45788f7464b7846bc58d7b90cc65240f Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Fri, 2 Oct 2015 22:27:57 +0200 Subject: Figures, hints and test cases added/updated for father, grandparent, brother, and sister problems. --- .../brother_2/Prolog_brother_01.svg | 317 +++++++++++++ .../brother_2/Prolog_brother_02.svg | 407 +++++++++++++++++ .../brother_2/Prolog_brother_03.svg | 311 +++++++++++++ .../brother_2/Prolog_brother_04.svg | 361 +++++++++++++++ .../brother_2/Prolog_brother_05.svg | 501 +++++++++++++++++++++ .../problems/family_relations/brother_2/common.py | 4 +- prolog/problems/family_relations/brother_2/sl.py | 16 +- .../problems/family_relations/father_2/common.py | 12 +- .../family_relations/grandparent_2/common.py | 11 +- .../family_relations/sister_2/Prolog_sister_01.svg | 312 +++++++++++++ .../family_relations/sister_2/Prolog_sister_02.svg | 414 +++++++++++++++++ .../family_relations/sister_2/Prolog_sister_03.svg | 317 +++++++++++++ .../family_relations/sister_2/Prolog_sister_04.svg | 356 +++++++++++++++ .../family_relations/sister_2/Prolog_sister_05.svg | 472 +++++++++++++++++++ .../problems/family_relations/sister_2/common.py | 2 +- prolog/problems/family_relations/sister_2/sl.py | 16 +- 16 files changed, 3809 insertions(+), 20 deletions(-) create mode 100644 prolog/problems/family_relations/brother_2/Prolog_brother_01.svg create mode 100644 prolog/problems/family_relations/brother_2/Prolog_brother_02.svg create mode 100644 prolog/problems/family_relations/brother_2/Prolog_brother_03.svg create mode 100644 prolog/problems/family_relations/brother_2/Prolog_brother_04.svg create mode 100644 prolog/problems/family_relations/brother_2/Prolog_brother_05.svg create mode 100644 prolog/problems/family_relations/sister_2/Prolog_sister_01.svg create mode 100644 prolog/problems/family_relations/sister_2/Prolog_sister_02.svg create mode 100644 prolog/problems/family_relations/sister_2/Prolog_sister_03.svg create mode 100644 prolog/problems/family_relations/sister_2/Prolog_sister_04.svg create mode 100644 prolog/problems/family_relations/sister_2/Prolog_sister_05.svg (limited to 'prolog/problems/family_relations') diff --git a/prolog/problems/family_relations/brother_2/Prolog_brother_01.svg b/prolog/problems/family_relations/brother_2/Prolog_brother_01.svg new file mode 100644 index 0000000..2c7a250 --- /dev/null +++ b/prolog/problems/family_relations/brother_2/Prolog_brother_01.svg @@ -0,0 +1,317 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/brother_2/Prolog_brother_02.svg b/prolog/problems/family_relations/brother_2/Prolog_brother_02.svg new file mode 100644 index 0000000..26f220d --- /dev/null +++ b/prolog/problems/family_relations/brother_2/Prolog_brother_02.svg @@ -0,0 +1,407 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/brother_2/Prolog_brother_03.svg b/prolog/problems/family_relations/brother_2/Prolog_brother_03.svg new file mode 100644 index 0000000..42608de --- /dev/null +++ b/prolog/problems/family_relations/brother_2/Prolog_brother_03.svg @@ -0,0 +1,311 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/brother_2/Prolog_brother_04.svg b/prolog/problems/family_relations/brother_2/Prolog_brother_04.svg new file mode 100644 index 0000000..fdc85c9 --- /dev/null +++ b/prolog/problems/family_relations/brother_2/Prolog_brother_04.svg @@ -0,0 +1,361 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/brother_2/Prolog_brother_05.svg b/prolog/problems/family_relations/brother_2/Prolog_brother_05.svg new file mode 100644 index 0000000..673859b --- /dev/null +++ b/prolog/problems/family_relations/brother_2/Prolog_brother_05.svg @@ -0,0 +1,501 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/brother_2/common.py b/prolog/problems/family_relations/brother_2/common.py index 327e746..3fb685f 100644 --- a/prolog/problems/family_relations/brother_2/common.py +++ b/prolog/problems/family_relations/brother_2/common.py @@ -34,6 +34,8 @@ test_cases = [ {'X': 'kramer'}, {'X': 'michael'}, {'X': 'william'}]), ('brother(andrew, X)', [{'X': 'melanie'}]), + ('brother(X, sally)', + [{'X': 'jeffrey'}, {'X': 'william'}]), ] def test(program, solved_problems): @@ -101,4 +103,4 @@ def hint(program, solved_problems): if engine_id: prolog.engine.destroy(engine_id) - return None + return [] diff --git a/prolog/problems/family_relations/brother_2/sl.py b/prolog/problems/family_relations/brother_2/sl.py index 2176bd8..f945026 100644 --- a/prolog/problems/family_relations/brother_2/sl.py +++ b/prolog/problems/family_relations/brother_2/sl.py @@ -14,27 +14,26 @@ description = '''\ plan = [ '''\ -

''', +

Brat je moškega spola in ima skupnega starša z Y.

''', '''\ -

''', +

Če je X moški in če imata X in Y skupnega starša, +potem je X brat od Y.

''', '''\ -

-
-parent(P, X)
-parent(P, Y)
-male(X)
-
''' +

Brat X je moškega spola in ima vsaj enega skupnega starša z Y.

''', ] hint = { 'x_y_must_be_different': '''\ +

Si pomislil, da sta X in Y lahko ista oseba? Poskusi naslednjo poizvedbo:

 ?- brother(william, Y).
 
+

VEČ... Kako naredim, da sta X in Y različna?

''', 'x_must_be_male': '''\ +

Brat je navadno moškega spola.

''', @@ -43,6 +42,7 @@ hint = { ''', 'common_parent_needed': '''\ +

Dobro bi bilo, da imata X in Y vsaj enega skupnega starša.

''', } diff --git a/prolog/problems/family_relations/father_2/common.py b/prolog/problems/family_relations/father_2/common.py index 1643066..50ac701 100644 --- a/prolog/problems/family_relations/father_2/common.py +++ b/prolog/problems/family_relations/father_2/common.py @@ -29,7 +29,17 @@ hint_type = { } test_cases = [ - # TODO + ('father(X, _)', + [{'X': 'aleksander'}, {'X': 'aleksandr'}, {'X': 'andrew'}, {'X': 'frank'}, + {'X': 'george'}, {'X': 'jerry'}, {'X': 'john'}, {'X': 'morty'}, + {'X': 'patrick'}, {'X': 'thomas'}, {'X': 'william'}]), + ('father(_, X)', + [{'X': 'aleksander'}, {'X': 'anna'}, {'X': 'daniela'}, {'X': 'george'}, + {'X': 'jeffrey'}, {'X': 'jerry'}, {'X': 'joanne'}, {'X': 'kramer'}, + {'X': 'luana'}, {'X': 'michael'}, {'X': 'michelle'}, {'X': 'patricia'}, + {'X': 'sally'}, {'X': 'susan'}, {'X': 'vanessa'}, {'X': 'william'}]), + ('father(X, aleksander)', + [{'X': 'aleksandr'}]), ] def test(program, solved_problems): diff --git a/prolog/problems/family_relations/grandparent_2/common.py b/prolog/problems/family_relations/grandparent_2/common.py index e9df06b..fec7734 100644 --- a/prolog/problems/family_relations/grandparent_2/common.py +++ b/prolog/problems/family_relations/grandparent_2/common.py @@ -31,7 +31,16 @@ hint_type = { } test_cases = [ - # TODO + ('grandparent(X, _)', + [{'X': 'aleksandr'}, {'X': 'ana'}, {'X': 'andrew'}, {'X': 'estelle'}, {'X': 'frank'}, + {'X': 'helen'}, {'X': 'jill'}, {'X': 'margaret'}, {'X': 'morty'}, {'X': 'patricia'}, + {'X': 'sally'}, {'X': 'thomas'}, {'X': 'tina'}, {'X': 'william'}]), + ('grandparent(_, X)', + [{'X': 'andrew'}, {'X': 'anna'}, {'X': 'daniela'}, {'X': 'joanne'}, {'X': 'john'}, + {'X': 'kramer'}, {'X': 'luana'}, {'X': 'melanie'}, {'X': 'michael'}, {'X': 'michelle'}, + {'X': 'patricia'}, {'X': 'steve'}, {'X': 'susan'}, {'X': 'vanessa'}]), + ('grandparent(tina, X)', + [{'X': 'vanessa'}, {'X': 'patricia'}]), ] def test(program, solved_problems): diff --git a/prolog/problems/family_relations/sister_2/Prolog_sister_01.svg b/prolog/problems/family_relations/sister_2/Prolog_sister_01.svg new file mode 100644 index 0000000..9699fb0 --- /dev/null +++ b/prolog/problems/family_relations/sister_2/Prolog_sister_01.svg @@ -0,0 +1,312 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/sister_2/Prolog_sister_02.svg b/prolog/problems/family_relations/sister_2/Prolog_sister_02.svg new file mode 100644 index 0000000..5a01b11 --- /dev/null +++ b/prolog/problems/family_relations/sister_2/Prolog_sister_02.svg @@ -0,0 +1,414 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/sister_2/Prolog_sister_03.svg b/prolog/problems/family_relations/sister_2/Prolog_sister_03.svg new file mode 100644 index 0000000..1565626 --- /dev/null +++ b/prolog/problems/family_relations/sister_2/Prolog_sister_03.svg @@ -0,0 +1,317 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/sister_2/Prolog_sister_04.svg b/prolog/problems/family_relations/sister_2/Prolog_sister_04.svg new file mode 100644 index 0000000..538be61 --- /dev/null +++ b/prolog/problems/family_relations/sister_2/Prolog_sister_04.svg @@ -0,0 +1,356 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/sister_2/Prolog_sister_05.svg b/prolog/problems/family_relations/sister_2/Prolog_sister_05.svg new file mode 100644 index 0000000..be58f2a --- /dev/null +++ b/prolog/problems/family_relations/sister_2/Prolog_sister_05.svg @@ -0,0 +1,472 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolog/problems/family_relations/sister_2/common.py b/prolog/problems/family_relations/sister_2/common.py index 6c48b00..b2bf954 100644 --- a/prolog/problems/family_relations/sister_2/common.py +++ b/prolog/problems/family_relations/sister_2/common.py @@ -153,4 +153,4 @@ def hint(program, solved_problems): if engine_id: prolog.engine.destroy(engine_id) - return None + return [] diff --git a/prolog/problems/family_relations/sister_2/sl.py b/prolog/problems/family_relations/sister_2/sl.py index 8c4c60f..1cb457d 100644 --- a/prolog/problems/family_relations/sister_2/sl.py +++ b/prolog/problems/family_relations/sister_2/sl.py @@ -13,27 +13,26 @@ description = '''\ plan = [ '''\ -

''', +

Sestra je ženskega spola in ima skupnega starša z Y.

''', '''\ -

''', +

Če je X ženska in če imata X in Y skupnega starša, +potem je X sestra od Y.

''', '''\ -

-
-parent(P, X)
-parent(P, Y)
-female(X)
-
''' +

Sestra X je ženskega spola in ima vsaj enega skupnega starša z Y.

''', ] hint = { 'x_y_must_be_different': '''\ +

Si pomislil, da sta X in Y lahko ista oseba? Poskusi naslednjo poizvedbo:

 ?- sister(sally, Y).
 
+

VEČ... Kako naredim, da sta X in Y različna?

''', 'x_must_be_female': '''\ +

Sestra je navadno ženskega spola.

''', @@ -42,6 +41,7 @@ hint = { ''', 'common_parent_needed': '''\ +

Dobro bi bilo, da imata X in Y vsaj enega skupnega starša.

''', } -- cgit v1.2.1