WeBWorK Problems

Custom answer checking for draggable proofs

Custom answer checking for draggable proofs

by Rohan Hitchcock -
Number of replies: 0

I am having some problems tried to write custom answer checkers for DraggableProof objects. Any advice or alternative approaches would be greatly appreciated. Thanks!

I am trying to write a custom answer checker for a DraggableProof object. The built-in answer checking for draggable proof requires students to enter the statements in the exact order specified to be marked correct. However, other orderings of statements may also be a valid proof and should also be marked correct. My solution for this is to write a custom answer checker.

Any custom answer checker seems to be ignored.

Consider the following draggable proof (see attached file for a MWE):

$proof = DraggableProof(
"\( 1 \leq 2 \)",
"\( 2 \leq 3 \)",
"The relation \(\leq\) is transitive",
"\( 1 \leq 3 \)",
], [
"irrelevant statement"
To demonstrate this behaviour, I tried to write an answer checker which will mark any submission correct. I have tried:

ANS( $proof->cmp( checker=>sub {
my ($correct, $student,$ans) = @_;
return 1;
and, using answerCustom.pl I also tried:
ANS(custom_cmp("0",sub {
my ($correct,$student,$ans) = @_;
return 1;
}, sameClass=>0, sameLength=>0)
In both cases, only the answer specified in the definition of  $proof is marked correct. Additionally, things like ``Value->Error("Message");`` don't in these custom answer checkers.

Other things I have tried
  • Using the "InferenceMatrix" option of DraggableProof, however this doesn't seem to be right for my purposes.
  • I am considering modifying and using a custom version of the file draggableProof.pl, but I am not sure where the answer checking is occurring in that file and so I don't know where to make the changes I need.