Scaffolding1: Difference between revisions
Paultpearson (talk | contribs) mNo edit summary |
Paultpearson (talk | contribs) mNo edit summary |
||
| Line 64: | Line 64: | ||
<p> | <p> | ||
<b>Initialization:</b> | <b>Initialization:</b> | ||
Use the <code>compoundProblem5.pl</code> macro to provide scaffolding (this macro may be renamed to <code>Scaffolding.pl</code> or <code>sequentiallyRevealed.pl</code> in the future). | |||
We initialize the scaffolding with the name <code>$scaffold</code>. | We initialize the scaffolding with the name <code>$scaffold</code>. | ||
Set <code>$isInstructor = 0;</code> when the problem is available to students, or set to 1 when debugging. | Set <code>$isInstructor = 0;</code> when the problem is available to students, or set to 1 when debugging. | ||
| Line 77: | Line 78: | ||
<!-- | <!-- Section 1 --> | ||
<tr valign="top"> | <tr valign="top"> | ||
| Line 84: | Line 85: | ||
Context("Numeric"); | 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; | |||
</pre> | </pre> | ||
</td> | </td> | ||
<td style="background-color:#ffffcc;padding:7px;"> | <td style="background-color:#ffffcc;padding:7px;"> | ||
<p> | <p> | ||
<b> | <b>Section 1:</b> | ||
Use <code>DISPLAY_SECTION</code> to set the parameters for the first section. | |||
Use <code>section=>1</code> to set the section number. | |||
Use <code>name=>"1: Descriptive title"</code> to give a title for the section. | |||
Since the first section should always be available to students, we set <code>canshow=>1</code>. | |||
Use <code>iscorrect=>$scaffold->requireCorrect(1,2)</code> to specify that this section will be marked all correct when the answers in answer boxes 1 and 2 are both correct. | |||
</p> | |||
<p> | |||
The text that gets displayed to students starts at "Continue..." | |||
</p> | |||
<p> | |||
Use <code>SECTION_ANS()</code> to record the correct weighted score into the grade book (i.e., database of scores). | |||
Note that we use <code>SECTION_ANS($answer->cmp)</code> before <code>$answer->ans_rule(width)</code>, which is a bit different from how things are usually done. | |||
</p> | |||
<p> | |||
It is also possible to provide a solution for each section. | |||
</p> | </p> | ||
</td> | </td> | ||
Revision as of 19:11, 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()->texStrings;
BEGIN_TEXT
Question text
$BR
$BR
Answer =
\{ ans_rule(20) \}
\{ AnswerFormatHelp("formulas") \}
END_TEXT
Context()->normalStrings;
|
Main Text: |
$showPartialCorrectAnswers = 1; ANS( $answer->cmp() ); |
Answer Evaluation: |
Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;
COMMENT('MathObject version.');
ENDDOCUMENT();
|
Solution: |