DraggableProofs: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<h2>Using the Sage Cell Server</h2> <!-- Header for these sections -- no modification needed --> <!-- 300px|thumb|right|Click to enlarge -->...") |
No edit summary |
||
Line 5: | Line 5: | ||
[[File:GraphicsFilename1.png|300px|thumb|right|Click to enlarge]] | [[File:GraphicsFilename1.png|300px|thumb|right|Click to enlarge]] | ||
--> | --> | ||
<p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;"> | <p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;"> | ||
This PG code shows how to | This PG code shows how to apply a javascript-enabled collection of drag and drop statements. | ||
</p> | </p> | ||
Line 30: | Line 30: | ||
loadMacros( | loadMacros( | ||
"PGstandard.pl", | "PGstandard.pl", | ||
" | "draggableProof.pl", | ||
); | ); | ||
</pre> | </pre> | ||
Line 38: | Line 38: | ||
<td style="background-color:#ccffcc;padding:7px;"> | <td style="background-color:#ccffcc;padding:7px;"> | ||
<p> The | <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> | </p> | ||
</td> | </td> | ||
</tr> | </tr> | ||
<!-- | <!-- Create the lists --> | ||
<tr valign="top"> | <tr valign="top"> | ||
<td style="background-color:#ffffdd;border:black 1px dashed;"> | <td style="background-color:#ffffdd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
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.", | |||
); | ); | ||
</pre> | </pre> | ||
</td> | </td> | ||
<td style="background-color:#ffcccc;padding:7px;"> | <td style="background-color:#ffcccc;padding:7px;"> | ||
Notice the format is: | |||
<p> | <p> | ||
[ list of correct statement in order], | |||
< | <br> | ||
[ list of incorrect statements in order], | |||
options | |||
</td> | </td> | ||
</tr> | </tr> | ||
Line 171: | Line 93: | ||
BEGIN_TEXT | BEGIN_TEXT | ||
\ | Select \{ $CorrectProof->numNeeded \} of the following. | ||
$PAR | |||
\{ $CorrectProof->Print \} | |||
END_TEXT | END_TEXT | ||
Context()->normalStrings; | Context()->normalStrings; | ||
# Answer Evaluation | # Answer Evaluation | ||
ANS($CorrectProof->cmp); | |||
Line 187: | Line 110: | ||
</pre> | </pre> | ||
<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. | |||
</td> | </td> | ||
</tr> | </tr> |
Revision as of 21:39, 20 November 2013
Using the Sage Cell Server
This PG code shows how to apply a javascript-enabled collection of drag and drop statements.
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "draggableProof.pl", ); |
The draggableProof.pl macro is not yet part of the standard WeBWorK distribution. You will need to download the macro file [sage.pl ] FIX THIS LINK and place it 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 statement in order],
|
## Lower WeBWorK text ## ## Problem display following the Sage cell ## 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. |