Difference between revisions of "DraggableProofs"

From WeBWorK_wiki
Jump to navigation Jump to search
m (typo)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<h2>Using the Sage Cell Server</h2>
+
<h2>Using Draggable Statements</h2>
   
 
<!-- Header for these sections -- no modification needed -->
 
<!-- Header for these sections -- no modification needed -->
Line 30: Line 30:
 
loadMacros(
 
loadMacros(
 
"PGstandard.pl",
 
"PGstandard.pl",
  +
"MathObjects.pl",
 
"draggableProof.pl",
 
"draggableProof.pl",
 
);
 
);
Line 38: Line 39:
   
 
<td style="background-color:#ccffcc;padding:7px;">
 
<td style="background-color:#ccffcc;padding:7px;">
<p> The draggableProof.pl macro is not yet part of the standard WeBWorK distribution. You will need to download the macro file [[https://github.com/drjt/pg/blob/feature/SageMacro/macros/sage.pl sage.pl ]] FIX THIS LINK and place it in your local macros directory for this to work.
+
<p> The draggableProof.pl macro can be found in [[https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/macros/MC/draggableProof.pl OpenProblemLibrary/macros/MC/draggableProof.pl]]. It is not yet part of the standard WeBWorK macros, so you have to place the file in your local macros directory for this to work.
 
</p>
 
</p>
 
</td>
 
</td>
Line 70: Line 71:
 
Notice the format is:
 
Notice the format is:
 
<p>
 
<p>
[ list of correct statement in order],
+
[ list of correct statements in order],
<br>
+
</p>
  +
<p>
 
[ list of incorrect statements in order],
 
[ list of incorrect statements in order],
<br>
+
</p>
  +
<p>
 
options
 
options
 
  +
</p>
 
</td>
 
</td>
 
</tr>
 
</tr>
Line 86: Line 87:
 
<td style="background-color:#eeddff;border:black 1px dashed;">
 
<td style="background-color:#eeddff;border:black 1px dashed;">
 
<pre>
 
<pre>
## Lower WeBWorK text
 
##
 
## Problem display following the Sage cell
 
##
 
 
 
Context()->texStrings;
 
Context()->texStrings;
   
Line 110: Line 106:
 
ENDDOCUMENT();
 
ENDDOCUMENT();
 
</pre>
 
</pre>
  +
</td>
  +
 
<td style="background-color:#ddddff;padding:7px;">
 
<td style="background-color:#ddddff;padding:7px;">
 
Notice, $CorrectProof->numNeeded returns the actual number of correct statements provided in the first list from above.
 
Notice, $CorrectProof->numNeeded returns the actual number of correct statements provided in the first list from above.

Latest revision as of 10:01, 20 June 2021

Using Draggable Statements


This PG code shows how to apply a javascript-enabled collection of drag and drop statements.

Problem Techniques Index

PG problem file Explanation
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"draggableProof.pl",
);

The draggableProof.pl macro can be found in [OpenProblemLibrary/macros/MC/draggableProof.pl]. It is not yet part of the standard WeBWorK macros, so you have to place the file in your local macros directory for this to work.

TEXT(beginproblem());

$CorrectProof = DraggableProof([
"Jason Aubrey",
"Someone better than Jason but less than everyone else",
"John Travis"
],

[
"Don't complain about it",
"\(x^2\)"
],

SourceLabel => "Choose from these",
TargetLabel =>  "Place the people in order of increasing usefulness.",
);

Notice the format is:

[ list of correct statements in order],

[ list of incorrect statements in order],

options

Context()->texStrings;

BEGIN_TEXT

Select \{ $CorrectProof->numNeeded \} of the following.

$PAR
\{ $CorrectProof->Print \}

END_TEXT
Context()->normalStrings;

# Answer Evaluation

ANS($CorrectProof->cmp);


ENDDOCUMENT();

Notice, $CorrectProof->numNeeded returns the actual number of correct statements provided in the first list from above.

Templates by Subject Area


Problem Techniques Index