Forum archive 2000-2006

David Vos - Unique problems

David Vos - Unique problems

by Arnold Pizer -
Number of replies: 0
inactiveTopicUnique problems topic started 3/11/2002; 9:14:57 AM
last post 3/12/2002; 1:31:31 AM
userDavid Vos - Unique problems  blueArrow
3/11/2002; 9:14:57 AM (reads: 855, responses: 2)
Is there a way in webwork to give each student an entirely (randomly assigned) different problem? I.e. give each student a different .pg file?

Is it possible to do something like the following in a .pg file:



if (some_random_number < 0) {
really_call_this_other_pg_file("other1.pg");
} else {
really_call_this_other_pg_file("other2.pg");
}

If it isn't possible, I think I've figured out a less-than-elegant way of doing it.

David

<| Post or View Comments |>


userArnold K. Pizer - Re: Unique problems  blueArrow
3/12/2002; 1:01:44 AM (reads: 1093, responses: 0)
Hi David,

Currently, it is not possible to assign random .pg files to different students just as it is not possible to randomize the order in which the various .pg files appear. Both options are under consideration for future verions of WeBWorK.

Of course, a single .pg file can have as much randomness as you want so you certainly can accomplih what you want using a single .pg file. This is probably what you mean by your "less-than-elegant way of doing it".

In a related but similar vain, I know one professor who uses WeBWorK for gateway testing by writing one giant .pg file that contains 40 separate sub problems maybe 10 of which are sleceted randomly each time. This is "less-than-elegant" but it works.

Arnie

<| Post or View Comments |>


userMichael Gage - Re: Unique problems  blueArrow
3/12/2002; 1:31:31 AM (reads: 1116, responses: 0)
Hi David,

As Arnie says, your particular project hasn't been done extensively. (In particular we'd like to implement a clean high level function, above the PGproblem interpreter, which selects which problem to render. ) However, you can probably do what you are suggesting. The model to follow is in PG_CAPAmacros.pl.

 

sub CAPA_import {
my $filePath = shift;
my %save_envir = %main::envir;
my $r_string = read_whole_problem_file($filePath);



$main::envir{'probFileName'} = $filePath;
$main::envir{'fileName'} = $filePath;
includePGtext($r_string); # the 0 prevents a new Safe compartment from being used
%main::envir = %save_envir;
}

The subroutine includePGtext is in lib/PGtranslator.pm if you need to understand how to use it. I would advise against modifying includePGtext since I'm pretty sure it is used elsewhere and in changing it you risk breaking existing code.

I would suggest writing a copy of the CAPA_import macro above in a macro file which you can include in your problems.

This subroutine has been used so far only for CAPA problems (which have an import file command). I think the basic idea will work for what you have in mind, but it may require some tweaking.

Let me know how it works out.

--Mike

<| Post or View Comments |>