From 5684a512562eeb4de8ca02643335408b91bf9546 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Fri, 19 Aug 2016 18:32:27 +0200 Subject: English translation for sister/2 and brother/2 added. --- prolog/problems/family_relations/brother_2/en.py | 71 +++++++++++++++++++++++- 1 file changed, 68 insertions(+), 3 deletions(-) (limited to 'prolog/problems/family_relations/brother_2') diff --git a/prolog/problems/family_relations/brother_2/en.py b/prolog/problems/family_relations/brother_2/en.py index 1295450..e0db1f5 100644 --- a/prolog/problems/family_relations/brother_2/en.py +++ b/prolog/problems/family_relations/brother_2/en.py @@ -2,11 +2,76 @@ name = 'brother/2' slug = 'the brother relation' description = '''\ -

brother(X, Y): X is a brother of Y.

+

brother(X, Y): X is a (half)brother of Y.

 ?- brother(jeffrey, X).
   X = william ;
   X = sally.
-
''' + +

Family trees are +described with predicates parent/2, male/1, and +female/1.

+''' -hint = {} +plan = [ + '''\ +

A brother is male and has a common parent with Y.

''', + '''\ +

If X is male and if X and Y share a common parent +then X is a brother of Y.

''', + '''\ +

Brother X is male and has
+at least one parent in common with Y.

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

+

What if X and Y are the same person? Try the following query:

+
+?- brother(william, Y).
+
''', 'linkText': 'How can I check that X and Y are different?'}, +'''\ +

Using the operator \== I can check that X and Y are different. +For example: X \== Y

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

+

A brother is usually male.

+''', + + 'y_can_be_of_any_gender': '''\ +

Y can actually be of any gender.

+''', + + 'neq+_instead_of_neq': '''\ +

Use the operator \== instead of operators \= or =\=. It succeeds when the two operands are not the same, +while \= succeeds if the operands cannot be made the same (cannot be unified), and =\= checks for +arithmetic inequality and in this case both operands should be immediately arithmetically computable.

+''', + + 'common_parent_needed': '''\ +

+

It would make sense if X and Y have at least one parent in common.

+''', + + 'neq_used_too_early': '''\ +

Did you use the operator \== too early?

+

Try moving it more towards the end of the rule. The problem is probably that the variables +you are comparing don't yet have values assigned to them and are therefore different by default. +Prolog doesn't check whether they become equal later, it only checks whether they're +equal or not at the moment of comparison.

+

Or maybe you're simply comparing the wrong two variables?

+''', + + 'predicate_always_false': '''\ +

It seems your predicate is always "false". Did you give it the correct name, +or is it perhaps misspelled?

+

If the name is correct, check whether something else is misspelled, perhaps there is a full stop instead of +a comma or vice versa, or maybe you typed a variable name in lowercase?

+

It is, of course, also possible that your conditions are too restrictive, or even impossible to satisfy +(as would be, for example, the condition that X is both a parent and a sister of Y, or +something similarly impossible).

+''', +} -- cgit v1.2.1