[system] / trunk / pg / macros / answerHints.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/answerHints.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5554 Revision 5555
64If more than one message matches the student's answer, the first 64If more than one message matches the student's answer, the first
65one in the list is used. 65one in the list is used.
66 66
67Example: 67Example:
68 68
69 ANS(Vector(1,2,3)->cmp(showCoordinateHints=>0)->withPostFilter(AnswerHints( 69 ANS(Vector(1,2,3)->cmp(showCoordinateHints=>0)->withPostFilter(AnswerHints(
70 Vector(0,0,0) => "The zero vector is not a valid solution", 70 Vector(0,0,0) => "The zero vector is not a valid solution",
71 "-<1,2,3>" => "Try the opposite direction", 71 "-<1,2,3>" => "Try the opposite direction",
72 "<1,2,3>" => "Well done!", 72 "<1,2,3>" => "Well done!",
73 ["<1,1,1>","<2,2,2>","<3,3,3>"] => "Don't just guess!", 73 ["<1,1,1>","<2,2,2>","<3,3,3>"] => "Don't just guess!",
74 sub { 74 sub {
75 my ($correct,$student,$ans) = @_; 75 my ($correct,$student,$ans) = @_;
76 return $correct . $student == 0; 76 return $correct . $student == 0;
77 } => "Your answer is perpendicular to the correct one", 77 } => "Your answer is perpendicular to the correct one",
78 Vector(1,2,3) => [ 78 Vector(1,2,3) => [
79 "You have the right direction, but not length", 79 "You have the right direction, but not length",
80 cmp_options => [parallel=>1], 80 cmp_options => [parallel=>1],
81 ], 81 ],
82 0 => ["Careful, your answer should be a vector!", checkTypes => 0, replaceMessage => 1], 82 0 => ["Careful, your answer should be a vector!", checkTypes => 0, replaceMessage => 1],
83 sub { 83 sub {
84 my ($correct,$student,$ans) = @_; 84 my ($correct,$student,$ans) = @_;
85 return norm($correct-$student) < .1; 85 return norm($correct-$student) < .1;
86 } => ["Close! Keep trying.", score => .25], 86 } => ["Close! Keep trying.", score => .25],
87 ))); 87 )));
88 88
89=cut 89=cut
90 90
91sub AnswerHints { 91sub AnswerHints {
92 return (sub { 92 return (sub {

Legend:
Removed from v.5554  
changed lines
  Added in v.5555

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9