Diff for /loncom/homework/default_homework.lcpm between versions 1.69 and 1.72

version 1.69, 2004/02/18 22:49:32 version 1.72, 2004/03/13 00:36:11
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 55  sub caparesponse_check { Line 55  sub caparesponse_check {
   #type's definitons come from capaParser.h    #type's definitons come from capaParser.h
   my $message='';    my $message='';
   #remove leading and trailing whitespace    #remove leading and trailing whitespace
     if (!defined($response)) {
         $response='';
     }
   if ($response=~ /^\s|\s$/) {    if ($response=~ /^\s|\s$/) {
     $response=~ s:^\s+|\s+$::g;      $response=~ s:^\s+|\s+$::g;
     $message .="Removed ws now :$response:\n";      $message .="Removed ws now :$response:\n";
Line 109  sub caparesponse_check { Line 112  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 134  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 170  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 191  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 {

Removed from v.1.69  
changed lines
  Added in v.1.72


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>