Re: Merging custom answer checkers with PostFilter Answer hints
by tim Payer -Re: Merging custom answer checkers with PostFilter Answer hints
by Davide Cervone -
loadMacros("contextArbitraryString.pl"); Context("ArbitraryString"); # # Messages in the form [test_score, message, new_score] # where the message will be used when the student score is less than # test_score, and the score will be set to new_score in that case, when # new_score is given. # @messages = ( [.50, "Oh no! You must score more than 50%, for any credit. Try again.", 0], [.60, "You could do better with another attempt, yes?"], [.70, "Try again. You can manage better than this."], [.75, "This is okay, But you could do better, yes?"], [.80, "You are getting better, Try another?"], [.85, "Nice Work!"], [.90, "Very Good!"], [.95, "Excellent!"], [1.0, "Perfect!"], ); TEXT(ans_rule(10)); ANS(String("100%")->cmp( checker => sub { my ($c, $s, $ans) = @_; $s =~ s/%//; my $score = $s/100; for my $data (@messages) { my ($percent, $msg, $nscore) = @$data; if ($score <= $percent) { $ans->{ans_message} = $msg; $score = $nscore if defined $nscore; last; } } return $score; } ));
This uses a list of cut-off scores and their associated messages (plus an optional new score to use when that message is given), and the answer checker loops through these scores and selected the appropriate message, which is places in the answer hash by hand, modifying the score to the new score, if needed.
Hope that does the trick.
Re: Merging custom answer checkers with PostFilter Answer hints
by tim Payer -Re: Merging custom answer checkers with PostFilter Answer hints
by Davide Cervone -NAMED_ANS()
not ANS(), and add answerBox =>
before the String()
call.
Re: Merging custom answer checkers with PostFilter Answer hints
by tim Payer -Re: Merging custom answer checkers with PostFilter Answer hints
by Michael Gage -TEXT(ans_rule(10));
That puts an extra answer rule in (named AnSwEr0001 since you didn't explicitly name it) and causes the error since you didn't create an answer evaluator for it using ANS(). I'm assuming you didn't want any obvious answer blank in the problem.
The geogebra applet handler creates a hidden answer blank explicitly
named 'answerBox'.
Incidentally setting one of the parameters debug=>1 (this can be done in a couple of places in the code) will show all of the hidden answer blanks. This can make the behavior of the geogebra applet less mysterious.
Re: Merging custom answer checkers with PostFilter Answer hints
by tim Payer -Re: Merging custom answer checkers with PostFilter Answer hints
by Andrew Parker -Re: Merging custom answer checkers with PostFilter Answer hints
by tim Payer -Re: Merging custom answer checkers with PostFilter Answer hints
by Michael Gage -Re: Merging custom answer checkers with PostFilter Answer hints
by Danny Glin -Re: Merging custom answer checkers with PostFilter Answer hints
by Davide Cervone -1) You say 90% gets full credit, but only marked full credit on 95% and above. (Easily fixed).
2) I think you want to use
\%
rather than \text{%}
in your correct_ans_latex_string
, as I think that is used in the PDF output when correct answers are requested, and the %
will act as a comment character (losing the rest of the line) in actual LaTeX. I haven't checked it, but that would be my suspicion.Otherwise, good work.
Re: Merging custom answer checkers with PostFilter Answer hints
by Andrew Parker -Re: Merging custom answer checkers with PostFilter Answer hints
by Davide Cervone -You are right, of course. My bad! Sorry!