[system] / trunk / pg / macros / problemRandomize.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/problemRandomize.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5372 Revision 5373
1 1
2=head3 problemRandomize.pl 2=head1 ProblemRandomize();
3 3
4###################################################################### 4 ######################################################################
5# 5 #
6# This file implements a mechanism for allowing a problem file to be 6 # This file implements a mechanism for allowing a problem file to be
7# "reseeded" so that the student can do additional versions of the 7 # "reseeded" so that the student can do additional versions of the
8# problem. You can control when the reseed message is available, 8 # problem. You can control when the reseed message is available,
9# and what style to use for it. 9 # and what style to use for it.
10# 10 #
11# To use the problemRandimize library, use 11 # To use the problemRandimize library, use
12# 12 #
13# loadMacros("problemRandomize.pl"); 13 # loadMacros("problemRandomize.pl");
14# 14 #
15# at the top of your problem file, and then create a problemRandomize 15 # at the top of your problem file, and then create a problemRandomize
16# object with 16 # object with
17# 17 #
18# $pr = ProblemRandomize(options); 18 # $pr = ProblemRandomize(options);
19# 19 #
20# where '$pr' is the name of the variable you will use to refer 20 # where '$pr' is the name of the variable you will use to refer
21# to the randomized problem (if needed), and 'options' can include: 21 # to the randomized problem (if needed), and 'options' can include:
22# 22 #
23# when => type Specifies the condition on which 23 # when => type Specifies the condition on which
24# reseeding the problem is allowed. 24 # reseeding the problem is allowed.
25# The choices include: 25 # The choices include:
26# 26 #
27# "Correct" (only when the problem has 27 # "Correct" (only when the problem has
28# been answered correctly.) 28 # been answered correctly.)
29# 29 #
30# "Always" (reseeding is always allowed.) 30 # "Always" (reseeding is always allowed.)
31# 31 #
32# Default: "Correct" 32 # Default: "Correct"
33# 33 #
34# onlyAfterDue => 0 or 1 Specifies if the reseed option is only 34 # onlyAfterDue => 0 or 1 Specifies if the reseed option is only
35# allowed after the due date has passed. 35 # allowed after the due date has passed.
36# Default: 1 36 # Default: 1
37# 37 #
38# style => type Determines the type of interaction needed 38 # style => type Determines the type of interaction needed
39# to reseed the problem. Types include: 39 # to reseed the problem. Types include:
40# 40 #
41# "Button" (a button) 41 # "Button" (a button)
42# 42 #
43# "Checkbox" (a checkbox plus pressing submit) 43 # "Checkbox" (a checkbox plus pressing submit)
44# 44 #
45# "Input" (an input box where the seed 45 # "Input" (an input box where the seed
46# can be set explicitly) 46 # can be set explicitly)
47# 47 #
48# "HTML" (the HTML is given explicitly 48 # "HTML" (the HTML is given explicitly
49# via the "label" option below) 49 # via the "label" option below)
50# 50 #
51# Default: "Button" 51 # Default: "Button"
52# 52 #
53# label => "text" Specifies the text used for the button name, 53 # label => "text" Specifies the text used for the button name,
54# checkbox label, input box label, or raw HTML 54 # checkbox label, input box label, or raw HTML
55# used for the reseed mechanism. 55 # used for the reseed mechanism.
56# 56 #
57# The problemRandomize library installs a special grader that handles determining 57 # The problemRandomize library installs a special grader that handles determining
58# when the reseed option will be available. It also redefines install_problem_grader 58 # when the reseed option will be available. It also redefines install_problem_grader
59# so that it will not overwrite the one installed by the library (it is stored so 59 # so that it will not overwrite the one installed by the library (it is stored so
60# that it can be called internally by the problemRandomize library's grader). 60 # that it can be called internally by the problemRandomize library's grader).
61# 61 #
62# Note that the problem will store the new problem seed only if the student can 62 # Note that the problem will store the new problem seed only if the student can
63# submit saved answers (i.e., only before the due date). After the due date, 63 # submit saved answers (i.e., only before the due date). After the due date,
64# the student can get new versions, but the problem will revert to the original 64 # the student can get new versions, but the problem will revert to the original
65# version when they come back to the problem later. Since the default is only 65 # version when they come back to the problem later. Since the default is only
66# to allow reseeding afer the due date, the reseeding will not be sticky by default. 66 # to allow reseeding afer the due date, the reseeding will not be sticky by default.
67# Hardcopy ALWAYS produces the original version of the problem, regardless of 67 # Hardcopy ALWAYS produces the original version of the problem, regardless of
68# the seed saved by the student. 68 # the seed saved by the student.
69# 69 #
70# Examples: 70 # Examples:
71# 71 #
72# ProblemRandomize(); # use all defaults 72 # ProblemRandomize(); # use all defaults
73# ProblemRandomize(when=>"Always"); # always can reseed (after due date) 73 # ProblemRandomize(when=>"Always"); # always can reseed (after due date)
74# ProblemRandomize(onlyAfterDue=>0); # can reseed whenever correct 74 # ProblemRandomize(onlyAfterDue=>0); # can reseed whenever correct
75# ProblemRandomize(when=>"always",onlyAfterDue=>0); # always can reseed 75 # ProblemRandomize(when=>"always",onlyAfterDue=>0); # always can reseed
76# 76 #
77# ProblemRandomize(style=>"Input"); # use an input box to set the seed 77 # ProblemRandomize(style=>"Input"); # use an input box to set the seed
78# 78 #
79# For problems that include "PGcourse.pl" in their loadMacros() calls, you can 79 # For problems that include "PGcourse.pl" in their loadMacros() calls, you can
80# use that file to provide reseed buttons for ALL problems simply by including 80 # use that file to provide reseed buttons for ALL problems simply by including
81# 81 #
82# loadMacros("problemRandomize.pl"); 82 # loadMacros("problemRandomize.pl");
83# ProblemRandomize(); 83 # ProblemRandomize();
84# 84 #
85# in PGcourse.pl. You can make the ProblemRandomize() be dependent on the set 85 # in PGcourse.pl. You can make the ProblemRandomize() be dependent on the set
86# number or the set or the login ID or whatever. For example 86 # number or the set or the login ID or whatever. For example
87# 87 #
88# loadMacros("problemRandomize.pl"); 88 # loadMacros("problemRandomize.pl");
89# ProblemRandomize(when=>"always",onlyAfterDue=>0,style=>"Input") 89 # ProblemRandomize(when=>"always",onlyAfterDue=>0,style=>"Input")
90# if $studentLogin eq "dpvc"; 90 # if $studentLogin eq "dpvc";
91# 91 #
92# would enable reseeding at any time for the user called "dpvc" (presumably a 92 # would enable reseeding at any time for the user called "dpvc" (presumably a
93# professor). You can test $probNum and $setNumber to make reseeding available 93 # professor). You can test $probNum and $setNumber to make reseeding available
94# only for specific sets or problems within a set. 94 # only for specific sets or problems within a set.
95# 95 #
96
97 96
98=cut 97=cut
99 98
100sub _problemRandomize_init { 99sub _problemRandomize_init {
101 sub ProblemRandomize {new problemRandomize(@_)} 100 sub ProblemRandomize {new problemRandomize(@_)}

Legend:
Removed from v.5372  
changed lines
  Added in v.5373

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9