Difference between revisions of "AnswerHints"
m |
|||
Line 7: | Line 7: | ||
<ul type="square"> |
<ul type="square"> |
||
<li>General answer hints that help students get started on a problem and are made available after a student has submitted an answer at least once (a "Show hints" checkbox appears near the "Submit Answers" button).</li> |
<li>General answer hints that help students get started on a problem and are made available after a student has submitted an answer at least once (a "Show hints" checkbox appears near the "Submit Answers" button).</li> |
||
− | <li> |
+ | <li>Specific, customized answer hints that appear in the answer feedback messages box after a student submits a particular answer that activates a pre-programmed hint.</li> |
</ul> |
</ul> |
||
<br /> |
<br /> |
||
Line 42: | Line 42: | ||
<p> |
<p> |
||
<b>Initialization:</b> |
<b>Initialization:</b> |
||
− | We need to include the macros file <code>MathObjects.pl</code> and <code>answerHints.pl</code>, which only works with MathObjects answer checkers (not old answer checkers). |
+ | We need to include the macros file <code>MathObjects.pl</code> and <code>answerHints.pl</code>, which only works with MathObjects answer checkers (not old answer checkers). General answer hints only require the standard macros, but specific (customized) answer hints require the <code>answerHints.pl</code> macro. |
</p> |
</p> |
||
</td> |
</td> |
||
Line 79: | Line 79: | ||
HINT(EV3(<<'END_HINT')); |
HINT(EV3(<<'END_HINT')); |
||
+ | ${PAR}${BBOLD}Hint:${EBOLD} |
||
Substitute \( 3u \) wherever you see \( t \) in the |
Substitute \( 3u \) wherever you see \( t \) in the |
||
formula for \( f \). |
formula for \( f \). |
||
END_HINT |
END_HINT |
||
− | |||
</pre> |
</pre> |
||
<td style="background-color:#ffcccc;padding:7px;"> |
<td style="background-color:#ffcccc;padding:7px;"> |
||
<p> |
<p> |
||
<b>Main Text:</b> |
<b>Main Text:</b> |
||
− | The problem text section of the file is as we'd expect. |
||
+ | We include a general answer hint in the block of text between <code>HINT(EV3(<<'END_HINT')); |
||
+ | ${PAR}${BBOLD}Hint:${EBOLD}</code> and <code>END_HINT</code>. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 109: | Line 110: | ||
<p> |
<p> |
||
<b>Answer Evaluation:</b> |
<b>Answer Evaluation:</b> |
||
− | + | To generate specific, customized answer hints for particular answers, te use the <code>AnswerHints</code> postfilter provided by <code>answerHints.pl</code>. The answer hints should be provided by a particular answer, followed by the hash table association operator <code>=></code>, followed by a string that will show up in the messages portion of the answer preview and feedback box when students submit their answers. You may include as many answer and hint pairs as you like, and even use subroutines in them (see [http://webwork.maa.org/doc/cvs/pg_CURRENT/macros/answerHints.pl answerHints.pl] for more on this). |
|
</p> |
</p> |
||
</td> |
</td> |
Revision as of 21:39, 8 February 2010
Answer Hints
This PG code shows how to include two different kinds of answer hints:
- General answer hints that help students get started on a problem and are made available after a student has submitted an answer at least once (a "Show hints" checkbox appears near the "Submit Answers" button).
- Specific, customized answer hints that appear in the answer feedback messages box after a student submits a particular answer that activates a pre-programmed hint.
You may also be interested in ErrorMessageCustomization
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "answerHints.pl", ); TEXT(beginproblem()); |
Initialization:
We need to include the macros file |
Context("Numeric"); Context()->variables->are(t=>"Real",u=>"Real"); $f = Formula("2 t"); $answer = Formula("6 u"); |
Setup:
We restrict the variables to |
Context()->texStrings; BEGIN_TEXT If \( f(t) = $f \), then \( f(3u) \) = \{ ans_rule(10) \} END_TEXT Context()->normalStrings; HINT(EV3(<<'END_HINT')); ${PAR}${BBOLD}Hint:${EBOLD} Substitute \( 3u \) wherever you see \( t \) in the formula for \( f \). END_HINT |
Main Text:
We include a general answer hint in the block of text between |
$showPartialCorrectAnswers = 1; ANS($answer->cmp() ->withPostFilter(AnswerHints( Formula("6 t") => "Are you using the correct variable?", Formula("6 u") => "Good work!", )) ); |
Answer Evaluation:
To generate specific, customized answer hints for particular answers, te use the |
- POD documentation: answerHints.pl
- PG macro code: answerHints.pl