summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2017-02-27 15:55:40 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2017-02-27 15:55:40 +0100
commit320f6db34b5da13e259c3a55db9996a456bf8839 (patch)
treeba29d4100aa10e4cde3cee5cb33f18ba35f82e52
parent04df55fae1bd1a26edcdfb702a24066ce49f5461 (diff)
Prolog: add texts for new automatic hints
-rw-r--r--prolog/common.py6
-rw-r--r--prolog/en.py49
-rw-r--r--prolog/sl.py49
3 files changed, 104 insertions, 0 deletions
diff --git a/prolog/common.py b/prolog/common.py
index e591e0b..73a8af4 100644
--- a/prolog/common.py
+++ b/prolog/common.py
@@ -17,6 +17,12 @@ hint_type = {
'monkey_change': HintPopup('monkey_change', style='change'),
'monkey_insert': HintPopup('monkey_insert', style='insert'),
'monkey_remove': HintPopup('monkey_remove', style='remove'),
+ 'monkey_highlight': HintPopup('monkey_highlight', style='highlight'),
+ 'monkey_buggy_literal': Hint('monkey_buggy_literal'),
+ 'monkey_buggy_variable': Hint('monkey_buggy_variable'),
+ 'monkey_singleton': Hint('monkey_singleton'),
+ 'monkey_missing': Hint('monkey_missing'),
+ 'monkey_unknown': Hint('monkey_unknown'),
'noncapitalised_variable': Hint('noncapitalised_variable'),
'noncapitalised_variable_markup': HintPopup('noncapitalised_variable_markup'),
'fail_rule': HintPopup('fail_rule'),
diff --git a/prolog/en.py b/prolog/en.py
index 17a6fc4..f31eab4 100644
--- a/prolog/en.py
+++ b/prolog/en.py
@@ -32,4 +32,53 @@ hint = {
'monkey_remove': '''\
<p>Remove the highlighted part.</p>
''',
+
+ 'monkey_highlight': None, # used to highlight erroneous tokens
+
+ 'monkey_buggy_literal': [
+'''\
+<p>Consider the highlighted values in the following program fragment:</p>
+<ul class="code" style="list-style: square inside; padding-left: 2em;">[%=fragments%]</ul>
+''',
+'''\
+<p>Do all values have the correct type (number/list/structure/…)? Do the highlighted arguments appear in correct relations with other objects in the program?</p>
+'''
+ ],
+
+ 'monkey_buggy_variable': [
+'''\
+<p>The variable <code>[%=variable%]</code> is used incorrectly. Pay particular attention to the following program ragments:</p>
+<ul class="code" style="list-style: square inside; padding-left: 2em;">[%=fragments%]</ul>
+''',
+'''\
+<p>Are all goals referencing the variable <code>[%=variable%]</code> correct?
+Check whether you are using the right predicate or operator, and that the highlighted arguments make sense.</p>
+<p>Do all occurrences of <code>[%=variable%]</code> denote the same value?
+In Prolog rules, each variable can only refer to a single value (e.g. person or number).</p>
+'''
+ ],
+
+ 'monkey_singleton': [
+'''\
+<p>The highlighted variable <code>[%=variable%]</code> appears only once in a rule:</p>
+<ul class="code" style="list-style: square inside; padding-left: 2em;">[%=fragments%]</ul>
+''',
+'''\
+<p>This is usually an error. Should the value denoted by the variable <code>[%=variable%]</code> appear anywhere else in the rule? Also check your program for typos.</p>
+'''
+ ],
+
+ 'monkey_missing': '''\
+<p>The program is partially correct, but not complete yet. Perhaps a goal is missing in one of the clauses, or another rule is needed.</p>
+''',
+
+ 'monkey_unknown': [
+'''\
+<p>Consider the highlighted program fragments:</p>
+<ul class="code" style="list-style: square inside; padding-left: 2em;">[%=fragments%]</ul>
+''',
+'''\
+<p>This pattern does not occur in known solutions to this problem. This can indicate a mistake in the program, or that you are implementing a novel solution.</p>
+'''
+ ],
}
diff --git a/prolog/sl.py b/prolog/sl.py
index f7209e6..3209742 100644
--- a/prolog/sl.py
+++ b/prolog/sl.py
@@ -44,6 +44,55 @@ hint = {
<p>Odstrani ta cilj.</p>
''',
+ 'monkey_highlight': None, # used to highlight erroneous tokens
+
+ 'monkey_buggy_literal': [
+'''\
+<p>Razmisli, ali so vrednosti v označenem delu programa pravilne:</p>
+<ul class="code" style="list-style: square inside; padding-left: 2em;">[%=fragments%]</ul>
+''',
+'''\
+<p>Ali so vse vrednosti pravilnih tipov (število/seznam/struktura/…)? Ali označeni argumenti nastopajo v pravih relacijah s spremenljivkami?</p>
+'''
+ ],
+
+ 'monkey_buggy_variable': [
+'''\
+<p>Spremenljivka <code>[%=variable%]</code> v programu ne nastopa pravilno. Posebej bodi pozoren na označene dele programa:</p>
+<ul class="code" style="list-style: square inside; padding-left: 2em;">[%=fragments%]</ul>
+''',
+'''\
+<p>Ali so vsi cilji, v katerih nastopa spremenljivka <code>[%=variable%]</code>, pravilni?
+Preveri, da gre za pravi predikat ali operator, in da so označeni argumenti smiselni.</p>
+<p>Ali spremenljivka <code>[%=variable%]</code> povsod označuje isto vrednost?
+V prologu vse pojavitve iste spremenljivke znotraj pravila zmeraj označujejo isti objekt (npr. osebo ali število).</p>
+'''
+ ],
+
+ 'monkey_singleton': [
+'''\
+<p>Označena spremenljivka <code>[%=variable%]</code> se v pravilu pojavi le na enem mestu:</p>
+<ul class="code" style="list-style: square inside; padding-left: 2em;">[%=fragments%]</ul>
+''',
+'''\
+<p>To običajno pomeni napako. Razmisli, ali bi vrednost, ki jo označuje <code>[%=variable%]</code>, morala nastopati še kje v pravilu. Preveri tudi, da v pravilu ni kakšnih tipkarskih napak.</p>
+'''
+ ],
+
+ 'monkey_missing': '''\
+<p>Program je deloma pravilen, vendar še ni dokončan. Morda v katerem od stavkov manjka kakšen cilj, ali pa potrebuješ še eno pravilo.</p>
+''',
+
+ 'monkey_unknown': [
+'''\
+<p>Preveri označene dele programa:</p>
+<ul class="code" style="list-style: square inside; padding-left: 2em;">[%=fragments%]</ul>
+''',
+'''\
+<p>Ta vzorec se ne pojavlja v doslej znanih rešitvah te naloge. To lahko pomeni, da je napačen, ali pa, da tvoj program implementira novo rešitev.</p>
+'''
+ ],
+
'noncapitalised_variable': '''\
<p>Preveri kodo, označeni so deli, kjer bi morda moral uporabiti velike črke, ki označujejo spremenljivke v prologu.</p>
''',