diff options
-rw-r--r-- | prolog/problems/family_relations/ancestor_2/en.py | 7 | ||||
-rw-r--r-- | prolog/problems/family_relations/descendant_2/en.py | 66 |
2 files changed, 39 insertions, 34 deletions
diff --git a/prolog/problems/family_relations/ancestor_2/en.py b/prolog/problems/family_relations/ancestor_2/en.py index cec2a29..322ab92 100644 --- a/prolog/problems/family_relations/ancestor_2/en.py +++ b/prolog/problems/family_relations/ancestor_2/en.py @@ -77,12 +77,13 @@ e.g. grandgrandparents or grandgrandgrandparents are also ancestors.</p> ''', 'predicate_always_false': '''\ -<p>It seems your predicate is <emph>always</emph> "false". Did you give it the correct name, or is it perhaps misspelled?</p> +<p>It seems your predicate is <emph>always</emph> "false". Did you give it the correct name, +or is it perhaps misspelled?</p> <p>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?</p> <p>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 <code>X</code> is both parent and a sister of <code>Y</code>, or -something similar).</p> +(as would be, for example, the condition that <code>X</code> is both a parent and a sister of <code>Y</code>, or +something similarly impossible).</p> ''', 'timeout': '''\ diff --git a/prolog/problems/family_relations/descendant_2/en.py b/prolog/problems/family_relations/descendant_2/en.py index 535ef23..c50ac17 100644 --- a/prolog/problems/family_relations/descendant_2/en.py +++ b/prolog/problems/family_relations/descendant_2/en.py @@ -15,81 +15,85 @@ described with predicates <code>parent/2</code>, <code>male/1</code>, and ''' plan = ['''\ -<p>I believe recursion is needed... how can we transpose the problem to a smaller one (a single step smaller that is)?</p> -<p><img src="[%@resource Prolog_descendant_03.svg%]" alt="A descendant of someone, who is a child of Y, is also a descendant of Y." /></p> +<p>I believe recursion is needed... how can we transpose the problem to a smaller one +(a single step smaller that is)?</p> +<p><img src="[%@resource Prolog_descendant_03.svg%]" alt="A descendant of someone, who is a child of Y, +is also a descendant of Y." /></p> ''', '''\ <p>If <code>Z</code> is a parent of some <code>X</code> and at the same time <code>Z</code> is a descendant of <code>Y</code>, then <code>X</code> is also a descendant of <code>Y</code>.</p> ''', '''\ -<p><img src="[%@resource Prolog_descendant_04.svg%]" alt="If X is a descendant of Z, and Z is a child of Y, then X is also a descendant of Y." /></p> +<p><img src="[%@resource Prolog_descendant_04.svg%]" alt="If X is a descendant of Z, and Z is a child of Y, +then X is also a descendant of Y." /></p> '''] hint = { 'gender_is_irrelevant': '''\ -<p>Je spol res pomemben?</p> +<p>Is gender really important?</p> ''', 'gender_is_irrelevant_markup': '''\ -<p>Je to res potrebno?</p> +<p>Is this necessary?</p> ''', 'grandparent_used': '''\ -<p>Rešitev z "grandparent" bo premalo splošna, poskusi nadomestiti to z rekurzijo. -Skratka, poskusi prevesti na "manjši" problem, npr. potomec v enem koraku manj -(en korak bližji potomec)...</p> +<p>The solution using the grandparent relation will not be general enough, try using recursion instead. +Try to transpose the problem into a "smaller" one, e.g. a descendant in one step less (a closer descendant).</p> ''', 'grandparent_used_markup': '''\ -<p>Bi se dalo rešiti brez tega?</p> +<p>Can you solve without using this?</p> ''', 'base_case': '''\ -<p>Si pomislil na robni pogoj? Rekurzija se mora enkrat tudi ustaviti. -Kaj je najbolj enostaven par (potomec, prednik)?</p> +<p>Did you think of a base case? The recursion has to stop at some point. +What is the most obvious pair (descendand, ancestor)?</p> <p><img src="[%@resource Prolog_descendant_01.svg%]" /></p> ''', # TODO: morda ta hint naredim z "more": najprej tekst, ob kliku pa še slika... (sicer je preveč očitno) 'descendant_of_oneself': '''\ -<p>Kako je lahko nekdo potomec samega sebe? Iz trenutne verzije rešitve se da izpeljati tudi to. -Premisli, morda se ti splača tudi grafično skicirati tvojo trenutno rešitev.</p> +<p>How can anyone be a descendant of him- or herself? This can be inferred from the current version of the program. +It might also help to graphically sketch your current solution.</p> ''', 'descendant_of_oneself_with_or': '''\ -<p>Kako je lahko nekdo potomec samega sebe? Iz trenutne verzije rešitve se da izpeljati tudi to. -Premisli, morda se ti splača tudi grafično skicirati tvojo trenutno rešitev.</p> -<p>Morda se ti splača preveriti tudi uporabo podpičja. To praktično naredi dva ločena stavka oz. veji -(eno ali drugo velja, morda tudi oboje). Vendar pazi, ker sta ti dve veji med seboj neodvisni --- vrednosti iz ene se ne prenašajo v drugo vejo.</p> +<p>How can anyone be a descendant of him- or herself? This can be inferred from the current version of the program. +It might help to graphically sketch your current solution.</p> +<p>Perhaps you should also check your use of the semicolon. The semicolon basically creates two separate clauses or +branches (one or the other can hold, or even both). However, be careful, as this two branches are independent of +one another -- assigned values to variables in one branch do not transfer to the other branch.</p> ''', 'descendant_need_not_be_parent': '''\ -<p>Potomec <code>X</code> pravzaprav ne rabi imeti otrok...</p> +<p>The descendant <code>X</code> doesn't actually need to have any children...</p> ''', 'predicate_always_false': '''\ -<p>Vse kaže, da tvoj predikat vedno vrne "false". Si mu dal pravilno ime, si se morda pri imenu zatipkal?</p> -<p>Če je ime pravilno, se morda splača preveriti tudi, če se nisi zatipkal kje drugje, -je morda kakšna pika namesto vejice ali obratno, morda kakšna spremenljivka z malo začetnico?</p> -<p>Možno je seveda tudi, da so tvoji pogoji prestrogi ali celo nemogoči (kot bi bila npr. zahteva, -da je <code>X</code> hkrati starš in sestra od <code>Y</code> ali kaj podobnega).</p> +<p>It seems your predicate is <emph>always</emph> "false". Did you give it the correct name, +or is it perhaps misspelled?</p> +<p>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?</p> +<p>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 <code>X</code> is both a parent and a sister of <code>Y</code>, or +something similarly impossible).</p> ''', 'timeout': '''\ -<p>Je morda na delu potencialno neskončna rekurzija? Kako se bo ustavila?</p> -<p>Morda pa je kriv tudi manjkajoč, neustrezen ali preprosto nekompatibilen (s splošnim primerom) robni pogoj?</p> +<p>Is there an infinite recursion at work here? How will it ever stop?</p> +<p>Or perhaps is there a missing, faulty, or simply incompatible (with the general recursive case) base case?</p> ''', 'wrong_direction': '''\ -<p>Si morda sprogramiral ravno obratno in zamenjal prednika s potomcem? -<code>X</code> naj bo potomec od <code>Y</code> in ne obratno!</p> +<p>Did you perhaps program exactly the reverse relation, ancestor instead of descendant? +<code>X</code> should be a descendant of <code>Y</code> and not the other way around!</p> <p><img src="[%@resource Prolog_descendant_02.svg%]" /></p> ''', # TODO: Tim, kako bi lahko še query poslali med parametri v Hint dict? Je to predvideno? Tukaj bi recimo pasalo... 'final_hint': '''\ -<p>Zanimivost: nalogo bi lahko rešil tudi z uporabo rešitve za relacijo <code>ancestor/2</code>. -Samo obrni spremenljivki <code>X</code> in <code>Y</code>; -če je <code>X</code> potomec od <code>Y</code>, potem je <code>Y</code> prednik od <code>X</code>.</p> +<p>Interesting tidbit. This exercise could also be solved using the solution to the <code>ancestor/2</code> +relation. Simply reverse the variables <code>X</code> and <code>Y</code>; +if <code>X</code> is a descendant of <code>Y</code>, then <code>Y</code> is an ancestor of <code>X</code>.</p> ''', } |