This shows how to setup a set of draggable items to sort.
Download file: DraggableSubsets.pg
DOCUMENT(); loadMacros('PGstandard.pl', 'PGML.pl', 'draggableSubsets.pl', 'PGcourse.pl');
Preamble
The draggableSubsets.pl
macro must be loaded.
$draggable = DraggableSubsets( [ 'mouse', 'ebola bacteria', 'flu virus', 'krill', 'house cat', 'emu', 'coyote', 'tapir', 'hippopotamus', 'elephant', 'blue whale', 'eagle' ], [ [], [ 0, 4, 6, 7, 8, 9, 10 ], [ 5, 11 ], [ 1, 2, 3 ] ], # ['mouse','house cat','coyote','tapir','hippopatamus','elephant'] DefaultSubsets => [ { label => 'Animals', indices => [ 0 .. 11 ] }, { label => 'Mammals', indices => [] }, { label => 'Birds', indices => [] }, { label => 'Other', indices => [] } ], AllowNewBuckets => 0, OrderedSubsets => 1 );
Setup
The DraggableSubsets call visually creates a set of regions called buckets that labelled boxes can be dragged between. The general form is
$draggable = DraggableSubsets(
$full_set,
$answer_sets,
%options
);
where $full_set
is the set of all labelled boxes. The $answer_sets
is a nested array reference of distribution of the correct subsets. There are many options. The example here shows the use of DefaultSubsets
which shows how to label and initialize the buckets. The AllowNewBuckets
option allows the student in add a new bucket (1) or not (0). The OrderedSubsets
option requires that the subsets in the student answer be the same as in the correct answer.
See the DraggableProofs for an example of how to create drag and drop proof problems.
BEGIN_PGML Move all animals from the "Animals" bucket into its appropriate bucket. [_]{$draggable} END_PGML
Statement
This is the problem statement in PGML.BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.