draggableProof.pl

Jump to: Site Navigation

NAME

draggableProof.pl

DESCRIPTION

This macro helps the instructor create a drag-and-drop environment in which students are asked to arrange predefined statements into a correct sequence.

TERMINOLOGY

An HTML element into or out of which other elements may be dragged will be called a "bucket". An HTML element which houses a collection of buckets will be called a "bucket pool".

USAGE

To initialize a DraggableProof bucket pool in a .pg problem, insert the line:

$draggable = DraggableProof($statements, $extra, Options1 => ..., Options2 => ...);

before BEGIN_TEXT (or BEGIN_PGML).

Then, call:

$draggable->Print (or [@ $draggable->Print @]* )

within the BEGIN_TEXT / END_TEXT (or BEGIN_PGML / END_PGML ) environment.

$statements, e.g. ["Socrates is a man.", "Socrates is mortal.", ...], is an array reference to the list of statements used in the correct proof. It is imperative that square brackets be used.

$extra, e.g. ["Roses are red."], is an array reference to the list statements extraneous to the proof. If there are no extraneous statements, use the empty array reference [].

By default, the score of the student answer is 100% if the draggable statements are placed in the exact same order as in the array referenced by $statements, with no inclusion of any statement from $extra. The score is 0% otherwise.

Available Options:

 NumBuckets => 1 or 2
 SourceLabel => <string>
 TargetLabel => <string>
 Levenshtein => 0 or 1
 DamerauLevenshtein => 0 or 1
 InferenceMatrix => <array reference>
 IrrelevancePenalty => <float>

Their usage is explained in the example below.

EXAMPLE

 DOCUMENT();
 loadMacros(
 "PGstandard.pl",
 "PGML.pl",
 "MathObjects.pl",
 "draggableProof.pl"
 );

 TEXT(beginproblem());

 $statements = [
 "All men are mortal.", #0
 "Socrates is a man.", #1
 "Socrates is mortal." #2
 ];

 $extra = [
 "Some animals are men.",
 "Beauty is immortal.",
 "Not all animals are men."
 ];

 $draggable = DraggableProof(
 $statements,
 $extra,
 NumBuckets => 2, # either 1 or 2.
 SourceLabel => "${BBOLD}Axioms${EBOLD}", # label of first bucket if NumBuckets = 2.
 #
 TargetLabel => "${BBOLD}Reasoning${EBOLD}",
 # label of second bucket if NumBuckets = 2,
 # of the only bucket if NumBuckets = 1.
 #
 # Levenshtein => 1,
 # If equal to 1, scoring is determined by the Levenshtein edit distance between student answer and correct answer.
 #
 # DamerauLevenshtein => 1,
 # If equal to 1, scoring is determined by the Damerau-Levenshtein distance between student answer and correct answer.
 # A pair of transposed adjacent statements is counted as two mistakes under Levenshtein scoring,
 # but as one mistake under Damerau-Levenshtein scoring.
 #
 InferenceMatrix => [
 [0, 0, 1],
 [0, 0, 1],
 [0, 0, 0]
 ],
 # (i, j)-entry is nonzero <=> statement i implies statement j.
 # The score of each corresponding inference is weighted according to the value of the matrix entry.
 #
 IrrelevancePenalty => 1
 # This option is processed only if the InferenceMatrix option is set.
 # Penalty for each extraneous statement in the student answer is <IrrelevancePenalty>
 # divided by the total number of inference points (i.e. sum of all entries in the InferenceMatrix).
 # Default value = 1.
 );


 BEGIN_PGML

 Show that Socrates is mortal by dragging the relevant *Axioms*
 into the *Reasoning* box in an appropriate order.

 [@ $draggable->Print @]*

 END_PGML

 ANS($draggable->cmp);

 ENDDOCUMENT();

Site Navigation