WeBWorK Problems

Using draggable statements in a scaffold.

Using draggable statements in a scaffold.

by Jason Diemer -
Number of replies: 0

I've tried using draggable statements in a scaffolded question.  I created the draggable statement question separately to make sure it worked independently.  Then I incorporated the question as part 1 of a scaffold.  This seems to break the draggable statement functionality.  The question no longer identifies the correct answer.  (The revealed correct answer seems to default to the first item in the list of "extra" items.)

Here is the scaffolded problem.  I've attached the non-scaffolded draggable statement question as a file for comparison.

DOCUMENT();

loadMacros(

  "PGstandard.pl",

  "MathObjects.pl",

  "PGML.pl",

  "scaffold.pl",

  "draggableProof.pl",

  "niceTables.pl",

);

TEXT(beginproblem());


Scaffold::Begin(can_open=>"first_incorrect",

                is_open=>"first_incorrect");


Section::Begin("Part 1: Find the equivalent conditional statement.");

$CorrectSequence=DraggableProof([

"\(".negate()."q\wedge".negate()."p\)","\(\wedge\)","\(p\vee".negate()."q\)","\(\rightarrow\)","\(".negate()."q\)"],["\(\vee\)","\(\longleftrightarrow\)","\(q\)"],

SourceLabel=>"Choose from these:",

TargetLabel=>"Argument:",

);

Context()->texStrings;

BEGIN_TEXT

Consider the following argument:

$PAR

$BCENTER

\[

\begin{array}{c}

    \sim\!q\, \wedge \sim\!p\\\

    \underline{p\, \vee \sim\!q}\\\

    \sim\!q\\\

  \end{array}

\]

$ECENTER

$PAR

In this question, you will determine the validity of this argument using a truth table.  You will do that in Part 2.

$PAR

The first step here in Part 1 is to translate the argument into a conditional statement.  Normally, you would write this conditional statement left-to-right, but in the exercise here, you will arrange the statements top-to-bottome rather than left-to-right.  For example, if you wanted to indicate \( A\rightarrow B\), you would drag the statements into the form

$PAR

$BCENTER

\[\begin{array}{l} A\\ \rightarrow\\ B \end{array}\]

$ECENTER

$PAR

Put \{ $CorrectSequence->numNeeded \} of the following elements in order to form the equivalent conditional statement:

$PAR

\{ $CorrectSequence->Print \}


END_TEXT

Context()->normalStrings;

ANS($CorrectSequence->cmp);

Section::End();


Section::Begin("Part 2: The truth table");


$showPartialCorrectAnswers=0;


@answer=qw(F F F T F T

           F T F T F T

           T F F F F T

           T T T T T T);

Context()->strings->add(T=>{},F=>{});


@fullsol=qw(T T F F F T F T

            T F F T F T F T

            F T T F F F F T

            F F T T T T T T);


$headrow=["\(p\)","\(q\)","\(".negate()." p\)","\(".negate()." q\)","\(".negate()." q\wedge".negate()."p\)","\(p\vee".negate()."q\)","\((".negate()." q\wedge".negate()."p)\wedge(p\vee".negate()."q)\)","\((".negate()." q\wedge".negate()."p)\wedge(p\vee".negate()."q)\rightarrow".negate()."q\)"];


BEGIN_PGML

Complete the truth table for the conditional associated with the argument


>>

[``\begin{array}{c}

    \sim\!q\, \wedge \sim\!p\\

    \underline{p\, \vee \sim\!q}\\

    \sim\!q\\

  \end{array}

``]

<<

[@ DataTable(

[

$headrow,

["T","T",ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1)],

["T","F",ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1)],

["F","T",ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1)],

["F","F",ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1),ans_rule(1)]

]

);

@]*

END_PGML

foreach my $i (@answer){

    ANS(String($i)->cmp());

}

Section::End();

Scaffold::End();

ENDDOCUMENT();