version 1.28, 2001/06/14 21:29:14
|
version 1.30, 2001/07/13 14:49:28
|
Line 21 sub caparesponse_check {
|
Line 21 sub caparesponse_check {
|
my $sig_lbound=''; #done |
my $sig_lbound=''; #done |
my $sig_ubound=''; #done |
my $sig_ubound=''; #done |
my $ans_fmt=''; |
my $ans_fmt=''; |
my $units=''; #done |
my $unit=''; #done |
my $calc=''; |
my $calc=''; |
my ($response,$expr)=@_; |
my ($response,$expr)=@_; |
|
|
($answer,$type,$tol,$sig,$ans_fmt, |
($answer,$type,$tol,$sig,$ans_fmt, |
$units,$calc) = eval $expr.';return $answer,$type,$tol,$sig,$ans_fmt,$units,$calc'; |
$unit,$calc) = eval $expr.';return $answer,$type,$tol,$sig,$ans_fmt,$unit,$calc'; |
#type's definitons come from capaParser.h |
#type's definitons come from capaParser.h |
if ($type eq '' ) { |
if ($type eq '' ) { |
if ( $answer eq ($answer *1.0)) { $type = 2; |
if ( $answer eq ($answer *1.0)) { $type = 2; |
Line 61 sub caparesponse_check {
|
Line 61 sub caparesponse_check {
|
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,$units,$calc); |
$ans_fmt,$unit,$calc); |
|
|
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 82 sub caparesponse_check {
|
Line 82 sub caparesponse_check {
|
|
|
sub caparesponse_check_list { |
sub caparesponse_check_list { |
my ($response,$expr)=@_; |
my ($response,$expr)=@_; |
|
# do these first, because who knows what varname the instructor might have used |
|
# but it probably isn't $CAPARESPONSE_CHECK_LIST_answer |
|
my $CAPARESPONSE_CHECK_LIST_answer = eval $expr.';return $answer'; |
|
my (@list) = eval $CAPARESPONSE_CHECK_LIST_answer; |
my $result=''; |
my $result=''; |
my $aresult=''; |
my $aresult=''; |
my $current_answer; |
my $current_answer; |
my $answer = eval $expr.';return $answer'; |
|
my (@list) = eval $answer; |
|
my (@responselist)=split /,/,$response; |
my (@responselist)=split /,/,$response; |
my $unit=''; |
my $unit=''; |
$result.="Final response :$responselist['-1']:<br />"; |
$result.="Final response :$responselist['-1']:<br />"; |