Difference between revisions of "Scaffolding1"
Paultpearson (talk | contribs) m |
(add historical tag and give links to newer problems.) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | <h2>Sequentially Revealed (Scaffolded) Problems</h2> |
||
+ | {{historical}} |
||
+ | |||
+ | <p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Misc/Scaffolding.html a newer version of this problem]</p> |
||
+ | |||
+ | <h2>Deprecated: Sequentially Revealed (Scaffolded) Problems</h2> |
||
[[File:Scaffolding1.png|300px|thumb|right|Click to enlarge]] |
[[File:Scaffolding1.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 create multi-part questions that hide from students parts that have not yet been answered correct. |
||
+ | This PG code shows how to create multi-part questions that hide from students parts that have not yet been answered correct. This example is deprecated: see [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/Scaffolding2_PGML.pg FortLewis/Authoring/Templates/Misc/Scaffolding2_PGML.pg] instead (requires macro file [https://github.com/openwebwork/pg/blob/master/macros/scaffold.pl scaffold.pl] from after December, 2014). |
||
</p> |
</p> |
||
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/Scaffolding1.pg FortLewis/Authoring/Templates/Misc/Scaffolding1.pg] |
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/Scaffolding1.pg FortLewis/Authoring/Templates/Misc/Scaffolding1.pg] |
||
Line 44: | Line 48: | ||
"MathObjects.pl", |
"MathObjects.pl", |
||
"compoundProblem5.pl", |
"compoundProblem5.pl", |
||
+ | #"scaffolding.pl", # alternate future name |
||
"PGcourse.pl", |
"PGcourse.pl", |
||
); |
); |
||
Line 64: | Line 69: | ||
<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> in the future as it is finalized). |
||
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 83: | ||
− | <!-- |
+ | <!-- Section 1 --> |
<tr valign="top"> |
<tr valign="top"> |
||
Line 84: | Line 90: | ||
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> |
||
</tr> |
</tr> |
||
− | <!-- |
+ | <!-- Section 2 --> |
<tr valign="top"> |
<tr valign="top"> |
||
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
+ | Context('Matrix'); |
||
+ | |||
+ | $M = Matrix([[1,2],[3,4]]); |
||
+ | $v = Matrix([[5],[6]]); |
||
+ | |||
+ | $answer2 = $M * $v; |
||
+ | |||
Context()->texStrings; |
Context()->texStrings; |
||
− | BEGIN_TEXT |
||
+ | DISPLAY_SECTION( { |
||
− | Question text |
||
+ | section=>2, |
||
− | $BR |
||
+ | name=>"2: Bungling", |
||
− | $BR |
||
+ | canshow =>$scaffold->requireCorrect(1,2). " or $isInstructor", |
||
− | Answer = |
||
+ | iscorrect=>$scaffold->requireCorrect(3), |
||
− | \{ ans_rule(20) \} |
||
+ | }, <<'END_SECTION'); |
||
− | \{ AnswerFormatHelp("formulas") \} |
||
+ | |||
− | END_TEXT |
||
+ | \( $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; |
Context()->normalStrings; |
||
</pre> |
</pre> |
||
<td style="background-color:#ffcccc;padding:7px;"> |
<td style="background-color:#ffcccc;padding:7px;"> |
||
<p> |
<p> |
||
− | <b> |
+ | <b>Section 2:</b> |
+ | For kicks, we change to the matrix context. |
||
+ | Use <code>canshow =>$scaffold->requireCorrect(1,2). " or $isInstructor"</code> to specify that this section (section 2) can be revealed if answer boxes 1 and 2 are both correct (from section 1) or if the permission level of the user is high enough. |
||
+ | Use <code>iscorrect=>$scaffold->requireCorrect(3)</code> to specify that this section (section 2) will be marked correct when the third answer (the entire matrix) is marked correct. |
||
+ | We used <code>$answer->ans_array(width)</code> to generate an array of answer boxes with the same size as the correct answer that are treated as a single entity when grading. |
||
</p> |
</p> |
||
</td> |
</td> |
||
</tr> |
</tr> |
||
− | <!-- |
+ | <!-- Section 3 --> |
<tr valign="top"> |
<tr valign="top"> |
||
<td style="background-color:#eeddff;border:black 1px dashed;"> |
<td style="background-color:#eeddff;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | $showPartialCorrectAnswers = 1; |
||
+ | $answer3a = Compute("NONE"); |
||
+ | $answer3b = Compute("DNE"); |
||
− | ANS( $answer->cmp() ); |
||
+ | 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; |
||
− | BEGIN_SOLUTION |
||
+ | DISPLAY_SECTION({ |
||
− | ${PAR}SOLUTION:${PAR} |
||
+ | section=>4, |
||
− | Solution explanation goes here. |
||
+ | 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> |
||
+ | <td style="background-color:#ddddff;padding:7px;"> |
||
+ | <p> |
||
+ | <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> |
||
+ | </td> |
||
+ | </tr> |
||
− | COMMENT('MathObject version.'); |
||
+ | |||
+ | |||
+ | |||
+ | <!-- Answer evaluation --> |
||
+ | |||
+ | <tr valign="top"> |
||
+ | <td style="background-color:#ffffdd;border:black 1px dashed;"> |
||
+ | <pre> |
||
+ | PROCESS_ANSWERS(); |
||
+ | |||
+ | $last_correct_section = PROCESS_SECTIONS(); |
||
+ | |||
+ | #determine which section to leave open |
||
+ | $opensection = $last_correct_section + 1; |
||
+ | $scaffold->openSections($opensection); |
||
+ | |||
+ | COMMENT('MathObject version. Uses compoundProblem5.pl |
||
+ | to hide parts that the student has not yet answered correct.'); |
||
ENDDOCUMENT(); |
ENDDOCUMENT(); |
||
</pre> |
</pre> |
||
− | <td style="background-color:#ddddff;padding:7px;"> |
||
+ | </td> |
||
+ | <td style="background-color:#ffffcc;padding:7px;"> |
||
<p> |
<p> |
||
− | <b> |
+ | <b>Answer evaluation:</b> |
+ | Note that the answer rules and answer evaluators are matched up in the order in which they are entered, and that the question will not work otherwise. |
||
+ | Use <code>PROCESS_SECTIONS()</code> to determine which sections should be revealed and which should be colored correct (green). |
||
+ | Use <code>$scaffold->openSections($opensection);</code> to specify which sections actually get revealed to students. |
||
</p> |
</p> |
||
</td> |
</td> |
Latest revision as of 06:57, 18 July 2023
This problem has been replaced with a newer version of this problem
Deprecated: 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. This example is deprecated: see FortLewis/Authoring/Templates/Misc/Scaffolding2_PGML.pg instead (requires macro file scaffold.pl from after December, 2014).
- File location in OPL: FortLewis/Authoring/Templates/Misc/Scaffolding1.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "compoundProblem5.pl", #"scaffolding.pl", # alternate future name "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?" |
PROCESS_ANSWERS(); $last_correct_section = PROCESS_SECTIONS(); #determine which section to leave open $opensection = $last_correct_section + 1; $scaffold->openSections($opensection); COMMENT('MathObject version. Uses compoundProblem5.pl to hide parts that the student has not yet answered correct.'); ENDDOCUMENT(); |
Answer evaluation:
Note that the answer rules and answer evaluators are matched up in the order in which they are entered, and that the question will not work otherwise.
Use |