WeBWorK Problems

change text & score as function of attempts

change text & score as function of attempts

by Dick Lane -
Number of replies: 3
It is easy to combine multiple-choice/multiple-response items with free-response items in a single problem template.  My usual practice is to allow unlimited scored attempts for any problem with at least one substantive free-response item.  I'm now considering whether it might be useful to restrict tries for a multiple-choice item without also restricting free responses in the same problem.

I've designed some problems where I would like to decrease the score for each of the first N wrong responses to a multiple-choice part, reveal its answer before it is found by exhaustion, and then allow unconstrained attempts on the remaining stuff.  For example, the main task could be to factor x^2 - 9 x - 70 or 3 x^2 + x - 70.  The multiple-choice item would present x+5 together with several choices from {x-2, x-3, x-5, x-7, x+2, x+7, x+14}.  If the first 2 or 3 choices are wrong, then disclose x+5 is a factor and tell the student to use that information to finish the factoring task.  If the whole problem allocates 50% to the multiple-choice and 50% to the free-response, then 1 failure on the multiple-choice might decrease its potential to 40%, 2 failures to 20%, and 3 failures to 0% but with correct response disclosed.

Revealing correct answer to the multiple-choice part could be handled by
if  ( $appropriate_system_variable > $N ) {    ####    BEGIN_TEXT and END_TEXT must be flush-left
        Correct answer to the multiple-choice part is $simpleFactor.
        Use this information to complete the factorization task.
#### what would be an $appropriate_system_variable ??

Could one of the Weighted Graders (http://webwork.maa.org/wiki/WeightedGrader) be used by a custom answer checker to apply an adaptive weighting?
In reply to Dick Lane

Re: change text & score as function of attempts

by Dick Lane -
Perhaps knowing an $appropriate_system_variable (counting student submissions) will suffice.

That could allow the weights used by the regular weighted grader to be indexed.

@mcWgt = ( 50 ,  40 , 20 , 0 ) ;    ##  perhaps ( 50, 50, 40, 20, 0 ) to avoid an off-by-one error

$try = min( 3 , $appropriate_system_variable );
WEIGHTED_ANS( $popup -> cmp() , $mcWgt[$try] ) ;
WEIGHTED_ANS( $listOfFactors -> cmp() , 50 );

I wonder whether there might be a subtle gotcha: could the change in weights reduce a previous score?  E.g., multiple-choice answered correctly on first submission but factorization is correct only on third.  Would the recorded score be 0.5 + 0.5 or (0.5)(0.2) + 0.5 ?
In reply to Dick Lane

Re: change text & score as function of attempts

by Paul Pearson -

I think you're looking for the environment variable


I seem to remember that it may be incremented 0,0,1,2,3,... instead of 0,1,2,3,...

I used this environment variable in the macro


which you may find useful.

Good luck!

Paul Pearson
In reply to Paul Pearson

Re: change text & score as function of attempts

by Paul Pearson -

One more thing: if you want to view all of the environment variables and their values use the macro PGinfo.pl and its method listVariables(). Here's an example.




\{ listVariables() \}