Yes
this is possible, but we have not written a problem grader that does
this since there are many ways of decreasing the score based on the
number of attempts.
You have to write a custom problem grader. See the examples in
setSampleGraders for how to call these in a WeBWorK problem. I'll show
you how to write one below. Lets call our new grader
decreasing_avg_problem_grader since it will be a variant of
avg_problem_grader. If you are going to use this for many problems, you
could put your new grader in a file called PGgraders.pl and in that
file put the
sub decreasing_avg_problem_grader { ...}
Put the file PGgraders.pl in the courseScripts directory and load it
into your problem with loadMacros so your would have code looking like
loadMacros( "PG.pl", "PGbasicmacros.pl", "PGchoicemacros.pl", "PGanswermacros.pl", "PGauxiliaryFunctions.pl", "PGgraders.pl" );
install_problem_grader(~~&decreasing_avg_problem_grader );
This is the method used by Prof. Zig Fiedorowicz of OSU for his custom graders. Now
how do you write a decreasing grader? Look at the sub
avg_problem_grader in .../system/courseScripts/PGanswermacros.pl .
You can copy this sub, rename it decreasing_avg_problem_grader and then
modify it as follows. Near the end of the subroutine you will find $problem_state{recorded_score} = $problem_result{score}if $problem_result{score} >$problem_state{recorded_score};
$problem_state{num_of_correct_ans}++ if $total == $count; $problem_state{num_of_incorrect_ans}++ if $total < $count ;
Note: the $problem_result{score} is a number in the range [0,1] that
gets multiplied by the value of the problem (usually 1,2, ... or 10
points) to get the actual student sccore on the problem.
This code replaces the recorded score by the current score if the
current score is higher. You also see that you have available the
recorded number of correct and incorrect attempts. Just before this
code you can modify $problem_result{score}, decreasing it based on the
number of attempts or the number of incorrect attempts. E.g. $problem_result{score} = .5*$problem_result{score} if $problem_state{num_of_incorrect_ans} > 3;
only allows 50% of the possible score after 3 incorrect attempts.
You also have to decide if you want to replace a higher score with a
lower one. We do not do this since it discourages students from
attempting to get the correct answer.
Finally, you should replace the line
$problem_result{msg} = 'You can earn partial credit on this problem.' if $count > 1;
by a message explaining to the student how the problem will be graded.
I would be cautious using decreasing scoring methods. In our
experience, we have found that allowing students unlimited attempts
without penalty encourges them to work on problems until they get them
correct.
< Post or View Comments >
