Diff for /loncom/homework/default_homework.lcpm between versions 1.59 and 1.62

version 1.59, 2003/03/25 23:00:18 version 1.62, 2003/05/23 07:04:44
Line 62  sub caparesponse_check { Line 62  sub caparesponse_check {
     $message .="no ws in :$response:\n";      $message .="no ws in :$response:\n";
   }    }
   
     if (length($response) > 500) { return "TOO_LONG: Answer too long"; }
   
   if ($type eq '' ) {    if ($type eq '' ) {
     $message .= "Didn't find a type :$type:$expr: defaulting\n";      $message .= "Didn't find a type :$type:$expr: defaulting\n";
     if ( $answer eq ($answer *1.0)) { $type = 2;      if ( $answer eq ($answer *1.0)) { $type = 2;
Line 82  sub caparesponse_check { Line 84  sub caparesponse_check {
   #formula type setup the sample points    #formula type setup the sample points
   if ($type eq '8') {    if ($type eq '8') {
     ($id_list,$points)=split(/@/,$samples);      ($id_list,$points)=split(/@/,$samples);
     $message.="Found :$points: points\n";      $message.="Found :$id_list:$points: points in $samples\n";
   }    }
   if ($tol eq '') {    if ($tol eq '') {
     $tol=0.0;      $tol=0.0;
Line 142  sub get_array_args { Line 144  sub get_array_args {
   }    }
   $GET_ARRAY_ARGS_result.="error:$@:\n";    $GET_ARRAY_ARGS_result.="error:$@:\n";
   # if the eval fails just use what is in the answer exactly    # if the eval fails just use what is in the answer exactly
   if (!defined(@GET_ARRAY_ARGS_list) || !defined($GET_ARRAY_ARGS_list[0])) {    if (!(@GET_ARRAY_ARGS_list) || !defined($GET_ARRAY_ARGS_list[0])) {
     $GET_ARRAY_ARGS_result.="list zero is undefined\n";      $GET_ARRAY_ARGS_result.="list zero is undefined\n";
     $GET_ARRAY_ARGS_list[0]=$CAPARESPONSE_CHECK_LIST_answer;      $GET_ARRAY_ARGS_list[0]=$CAPARESPONSE_CHECK_LIST_answer;
   }    }
Line 151  sub get_array_args { Line 153  sub get_array_args {
   
 sub caparesponse_check_list {  sub caparesponse_check_list {
   my ($response,$expr)=@_;    my ($response,$expr)=@_;
   my $result;  
   $expr =~ s/\\/\\\\/g;    $expr =~ s/\\/\\\\/g;
   $expr =~ s/\'/\\\'/g;    $expr =~ s/\'/\\\'/g;
   my ($result,@list) = &get_array_args($expr,'answer');    my ($result,@list) = &get_array_args($expr,'answer');
Line 239  sub hinton { Line 240  sub hinton {
 }  }
   
 sub random {  sub random {
   my ($start,$end,$step)=@_;      my ($start,$end,$step)=@_;
   if ( ! $hidden::RANDOMINIT ) {      if ( ! $hidden::RANDOMINIT ) {
     if ($external::randomseed == 0) { $external::randomseed=1; }   if ($external::randomseed == 0) { $external::randomseed=1; }
     &random_set_seed(1,int(abs($external::randomseed)));   if ($external::randomseed =~/,/) {
     &math_random_uniform();      my ($num1,$num2)=split(/,/,$seed);
     $hidden::RANDOMINIT=1;      &random_set_seed(abs($num1),abs($num2));
   }   } else {
   if (!defined($step)) { $step=1; }      &random_set_seed(1,int(abs($external::randomseed)));
   my $num=1+int(($end-$start)/$step);   }
   my $result=$start + int(&math_random_uniform() * $num)*$step;   &math_random_uniform();
   return $result;   $hidden::RANDOMINIT=1;
       }
       if (!defined($step)) { $step=1; }
       my $num=1+int(($end-$start)/$step);
       my $result=$start + int(&math_random_uniform() * $num)*$step;
       return $result;
 }  }
   
 sub random_normal {  sub random_normal {

Removed from v.1.59  
changed lines
  Added in v.1.62


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