Scaffolding1: Difference between revisions
Paultpearson (talk | contribs) mNo edit summary |
Paultpearson (talk | contribs) mNo edit summary |
||
| Line 176: | Line 176: | ||
<td style="background-color:#eeddff;border:black 1px dashed;"> | <td style="background-color:#eeddff;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
$ | $answer3a = Compute("NONE"); | ||
$answer3b = Compute("DNE"); | |||
Context()->texStrings; | |||
DISPLAY_SECTION({ | |||
section=>3, | |||
name=>"3: False concepts", | |||
canshow =>$scaffold->requireCorrect(3). " or $isInstructor", | |||
iscorrect=>$scaffold->requireCorrect(4,5), | |||
}, <<'END_SECTION'); | |||
Enter ${BTT}NONE${ETT}: \{SECTION_ANS($answer3a->cmp), $answer3a->ans_rule(10)\} | |||
$BR | |||
Enter ${BTT}DNE${ETT}: \{SECTION_ANS($answer3b->cmp), $answer3b->ans_rule(10) \}. | |||
END_SECTION | |||
SECTION_SOLUTION({section=>3},<<'END_SOLUTION'); | |||
Solution text goes here. | |||
END_SOLUTION | |||
Context()->normalStrings; | |||
</pre> | </pre> | ||
<td style="background-color:#eeccff;padding:7px;"> | <td style="background-color:#eeccff;padding:7px;"> | ||
<p> | <p> | ||
<b> | <b>Section 3:</b> | ||
Same syntax as before. | |||
Since the third section is revealed only after the section section is correct, we can use <code>canshow =>$scaffold->requireCorrect(3)</code> to specify that this section (section 3) will be revealed only when answer blank 3 (the matrix from section 2) is correct. | |||
This section will be marked correct only when answer boxes 4 and 5 are both correct, as specified by <code>iscorrect=>$scaffold->requireCorrect(4,5)</code>. | |||
</p> | </p> | ||
</td> | </td> | ||
</tr> | </tr> | ||
<!-- | <!-- Section 4 --> | ||
<tr valign="top"> | <tr valign="top"> | ||
<td style="background-color:#ddddff;border:black 1px dashed;"> | <td style="background-color:#ddddff;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
foreach my $i (1..5) { | |||
$answer4[$i] = Compute($i); | |||
} | |||
Context()->texStrings; | Context()->texStrings; | ||
DISPLAY_SECTION({ | |||
${ | section=>4, | ||
name=>"4: Superstition", | |||
canshow =>$scaffold->requireCorrect(5). " or $isInstructor", | |||
iscorrect=>$scaffold->requireCorrect(6..10), | |||
}, <<'END_SECTION'); | |||
Enter 1, 2, 3, 4, 5: | |||
\{$answer4[1]->ans_rule(3)\}, | |||
\{$answer4[2]->ans_rule(3)\}, | |||
\{$answer4[3]->ans_rule(3)\}, | |||
\{$answer4[4]->ans_rule(3)\}, | |||
\{$answer4[5]->ans_rule(3)\}. | |||
END_SECTION | |||
foreach my $i (1..5) { | |||
SECTION_ANS($answer4[$i]->cmp) | |||
} | |||
SECTION_SOLUTION({section=>4},<<'END_SOLUTION'); | |||
It's a little known fact that | |||
antiquated ideas, bungling, false concepts, and superstition | |||
are the labels on the file drawers inside of Donald Duck's brain | |||
in the movie Donald Duck in Mathmagic Land. | |||
END_SOLUTION | END_SOLUTION | ||
Context()->normalStrings; | Context()->normalStrings; | ||
</pre> | </pre> | ||
<td style="background-color:#ddddff;padding:7px;"> | <td style="background-color:#ddddff;padding:7px;"> | ||
<p> | <p> | ||
<b> | <b>Section 4:</b> | ||
We use for loops to deal with the five answers and answer checkers in this section. | |||
Note that in the code we have pulled the <code>SECTION_ANS()</code> commands away from the <code>ans_rule(width)</code> answer boxes, which is to say that we're using the "standard approach" to formatting our code, which helps us use the for loops. | |||
</p> | |||
<p> | |||
The solution gives an answer to the question, "Where did the section titles come from?" | |||
</p> | </p> | ||
</td> | </td> | ||
Revision as of 19:24, 29 June 2014
Sequentially Revealed (Scaffolded) Problems

This PG code shows how to create multi-part questions that hide from students parts that have not yet been answered correct.
- File location in OPL: FortLewis/Authoring/Templates/Misc/Scaffolding1.pg
| PG problem file | Explanation |
|---|---|
|
Problem tagging: |
|
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"compoundProblem5.pl",
"PGcourse.pl",
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
$scaffold = Scaffold();
INITIALIZE_SCAFFOLD('$scaffold');
$isInstructor = 0; # = 0 when students use it
TEXT(MODES(
HTML=>'Clicking on a section opens it
provided that you have answered previous sections correctly.',
TeX=>''));
|
Initialization:
Use the $isInstructor = ($envir{effectivePermissionLevel} >=
$envir{ALWAYS_SHOW_SOLUTION_PERMISSION_LEVEL});
to ensure that only users that always have permission to show correct answers can open all of the sections of the scaffolding without needing to enter correct answers. |
Context("Numeric");
$answer1a = Compute(11);
$answer1b = Compute(12);
Context()->texStrings;
DISPLAY_SECTION({
section=>1,
name=>"1: Antiquated ideas (a descriptive title)",
canshow =>1,
iscorrect=>$scaffold->requireCorrect(1,2),
} , <<'END_SECTION');
Continue the pattern: 7, 8, 9, 10,
\{SECTION_ANS($answer1a->cmp), $answer1a->ans_rule(3) \},
\{SECTION_ANS($answer1b->cmp), $answer1b->ans_rule(3)\}.
END_SECTION
SECTION_SOLUTION({section=>1},<<'END_SOLUTION');
$PAR
Put some text here for the solution to section 1.
END_SOLUTION
Context()->normalStrings;
|
Section 1:
Use The text that gets displayed to students starts at "Continue..."
Use It is also possible to provide a solution for each section. |
Context('Matrix');
$M = Matrix([[1,2],[3,4]]);
$v = Matrix([[5],[6]]);
$answer2 = $M * $v;
Context()->texStrings;
DISPLAY_SECTION( {
section=>2,
name=>"2: Bungling",
canshow =>$scaffold->requireCorrect(1,2). " or $isInstructor",
iscorrect=>$scaffold->requireCorrect(3),
}, <<'END_SECTION');
\( $M $v = \) \{SECTION_ANS($answer2->cmp()), $answer2->ans_array()\}
END_SECTION
SECTION_SOLUTION({section=>2},<<'END_SOLUTION');
Put solution text here.
END_SOLUTION
Context()->normalStrings;
|
Section 2:
For kicks, we change to the matrix context.
Use |
$answer3a = Compute("NONE");
$answer3b = Compute("DNE");
Context()->texStrings;
DISPLAY_SECTION({
section=>3,
name=>"3: False concepts",
canshow =>$scaffold->requireCorrect(3). " or $isInstructor",
iscorrect=>$scaffold->requireCorrect(4,5),
}, <<'END_SECTION');
Enter ${BTT}NONE${ETT}: \{SECTION_ANS($answer3a->cmp), $answer3a->ans_rule(10)\}
$BR
Enter ${BTT}DNE${ETT}: \{SECTION_ANS($answer3b->cmp), $answer3b->ans_rule(10) \}.
END_SECTION
SECTION_SOLUTION({section=>3},<<'END_SOLUTION');
Solution text goes here.
END_SOLUTION
Context()->normalStrings;
|
Section 3:
Same syntax as before.
Since the third section is revealed only after the section section is correct, we can use |
foreach my $i (1..5) {
$answer4[$i] = Compute($i);
}
Context()->texStrings;
DISPLAY_SECTION({
section=>4,
name=>"4: Superstition",
canshow =>$scaffold->requireCorrect(5). " or $isInstructor",
iscorrect=>$scaffold->requireCorrect(6..10),
}, <<'END_SECTION');
Enter 1, 2, 3, 4, 5:
\{$answer4[1]->ans_rule(3)\},
\{$answer4[2]->ans_rule(3)\},
\{$answer4[3]->ans_rule(3)\},
\{$answer4[4]->ans_rule(3)\},
\{$answer4[5]->ans_rule(3)\}.
END_SECTION
foreach my $i (1..5) {
SECTION_ANS($answer4[$i]->cmp)
}
SECTION_SOLUTION({section=>4},<<'END_SOLUTION');
It's a little known fact that
antiquated ideas, bungling, false concepts, and superstition
are the labels on the file drawers inside of Donald Duck's brain
in the movie Donald Duck in Mathmagic Land.
END_SOLUTION
Context()->normalStrings;
|
Section 4:
We use for loops to deal with the five answers and answer checkers in this section.
Note that in the code we have pulled the The solution gives an answer to the question, "Where did the section titles come from?" |