version 1.69, 2004/02/18 22:49:32
|
version 1.71, 2004/03/12 21:06:19
|
Line 44 sub caparesponse_check {
|
Line 44 sub caparesponse_check {
|
#not to be used: $ans_fmt |
#not to be used: $ans_fmt |
my ($type,$tol,$sig,$ans_fmt,$unit,$calc,$samples) = |
my ($type,$tol,$sig,$ans_fmt,$unit,$calc,$samples) = |
eval $_[2]. |
eval $_[2]. |
';return ($type,$tol,$sig,$ans_fmt,$unit,$calc,$samples);'; |
';return ($__LC__type,$__LC__tol,$__LC__sig,$__LC__ans_fmt,$__LC__unit,$__LC__calc,$__LC__samples);'; |
|
|
my $tol_type=''; # gets it's value from whether tol has a % or not done |
my $tol_type=''; # gets it's value from whether tol has a % or not done |
my $sig_lbound=''; #done |
my $sig_lbound=''; #done |
Line 109 sub caparesponse_check {
|
Line 109 sub caparesponse_check {
|
} |
} |
if (!defined($sig_ubound)) { $sig_ubound=$sig_lbound; } |
if (!defined($sig_ubound)) { $sig_ubound=$sig_lbound; } |
} |
} |
|
my $reterror=""; |
my $result = &caparesponse_capa_check_answer($response,$answer,$type, |
my $result = &caparesponse_capa_check_answer($response,$answer,$type, |
$tol_type,$tol, |
$tol_type,$tol, |
$sig_lbound,$sig_ubound, |
$sig_lbound,$sig_ubound, |
$ans_fmt,$unit,$calc,$id_list, |
$ans_fmt,$unit,$calc,$id_list, |
$points,$external::randomseed); |
$points,$external::randomseed, |
|
\$reterror); |
|
|
if ($result == '1') { $result='EXACT_ANS'; } |
if ($result == '1') { $result='EXACT_ANS'; } |
elsif ($result == '2') { $result='APPROX_ANS'; } |
elsif ($result == '2') { $result='APPROX_ANS'; } |
Line 129 sub caparesponse_check {
|
Line 131 sub caparesponse_check {
|
elsif ($result =='12') { $result='WANTED_NUMERIC'; } |
elsif ($result =='12') { $result='WANTED_NUMERIC'; } |
else {$result = "ERROR: Unknown Result:$result:$@:";} |
else {$result = "ERROR: Unknown Result:$result:$@:";} |
|
|
return "$result:\nError $error:\nAnswer $answer:\nResponse $response:\n type-$type|$tol|$tol_type|$sig:$sig_lbound:$sig_ubound|$unit|\n$message$expr"; |
return ("$result:\nRetError $reterror:\nError $error:\nAnswer $answer:\nResponse $response:\n type-$type|$tol|$tol_type|$sig:$sig_lbound:$sig_ubound|$unit|\n$message$expr",$reterror); |
} |
} |
|
|
sub get_array_args { |
sub get_array_args { |
Line 165 sub caparesponse_check_list {
|
Line 167 sub caparesponse_check_list {
|
my $answers=join(':',@list); |
my $answers=join(':',@list); |
$result.="Got response :$answers:\n"; |
$result.="Got response :$answers:\n"; |
my @responselist; |
my @responselist; |
my $type =eval $expr.';return $type;'; |
my $type =eval $expr.';return $__LC__type;'; |
|
$result.="Got type :$type:\n"; |
if ($type ne '' && $#list > 0) { |
if ($type ne '' && $#list > 0) { |
(@responselist)=split /,/,$response; |
(@responselist)=split /,/,$response; |
} else { |
} else { |
Line 185 sub caparesponse_check_list {
|
Line 188 sub caparesponse_check_list {
|
$unit=~s/\s//; |
$unit=~s/\s//; |
my $i=0; |
my $i=0; |
my $awards=''; |
my $awards=''; |
|
my @msgs; |
for ($i=0; $i<@list;$i++) { |
for ($i=0; $i<@list;$i++) { |
|
my $msg; |
$result.="trying answer :$list[$i]:\n"; |
$result.="trying answer :$list[$i]:\n"; |
my $thisanswer=$list[$i]; |
my $thisanswer=$list[$i]; |
# $thisanswer=~ s/\\/\\\\/g; |
# $thisanswer=~ s/\\/\\\\/g; |
# $thisanswer =~ s/\'/\\\'/g; |
# $thisanswer =~ s/\'/\\\'/g; |
$result.="trying answer :$thisanswer:\n"; |
$result.="trying answer :$thisanswer:\n"; |
if ($unit eq '') { |
if ($unit eq '') { |
$aresult=&caparesponse_check($thisanswer,$responselist[$i], |
($aresult,$msg)=&caparesponse_check($thisanswer,$responselist[$i], |
$expr); |
$expr); |
} else { |
} else { |
$aresult=&caparesponse_check($thisanswer,$responselist[$i]." $unit", |
($aresult,$msg)=&caparesponse_check($thisanswer, |
$expr); |
$responselist[$i]." $unit", |
|
$expr); |
} |
} |
my ($temp)=split /:/, $aresult; |
my ($temp)=split /:/, $aresult; |
$awards.="$temp,"; |
$awards.="$temp,"; |
$result.=$aresult; |
$result.=$aresult; |
|
push(@msgs,$msg); |
} |
} |
chop $awards; |
chop $awards; |
return "$awards:\n$result"; |
return ("$awards:\n$result",@msgs); |
} |
} |
|
|
sub tex { |
sub tex { |