Features & Development

Using multiple source files for a single problem

by Danny Glin -
Number of replies: 2
Has anyone experimented with having webwork randomly select from a list of pg files for a single problem?  What we would like to do is create an assignment in which the source for each question is a list of pg files, where for a given seed (or student) webwork selects one of the files to display.  Any thoughts?

Re: Using multiple source files for a single problem

by Davide Cervone -
The Union macro library has a file called unionInclude.pl that implements what I think you are looking for. If you create a PG file containing
 DOCUMENT(); loadMacros("unionInclude.pl"); includeRandomProblem( "file1.pg",
"file2.pg",
...
"filen.pg",
);

ENDDOCUMENT();

and then create a problem set that contains one or more instances of this file. Each copy of the file will include a different random problem from the list of files given, and each student will see the problems in a different order.

Some time ago I put together some macros for allowing a single problem to load several different problem files (at the student's request), so that a single problem could be used for practice more practice problems of the same type until the student was satisfied. This is slightly different from what you are talking about, but might be useful anyway. You can see the discussion at

(near the end of a string of comments on this -- search for Davide -- [ed.])

and a link to the macro files is
 http://cvs.webwork.rochester.edu/viewcvs.cgi/union_problib/examples/multiProblem/?cvsroot=Union+College

Hope that helps.

Davide

(Edited by Michael Gage - original submission Friday, 2 February 2007, 10:20 PM)

    group:setname
where setname is the name of a problem set that lists all of the problems from which to select. It need not (arguably, should not) be assigned to anyone, as it serves just as a container for the group of problems that are being selected.