File:  [Local Repository] / processmail / collection.pl
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Wed Feb 16 22:25:59 2005 UTC (19 years, 4 months ago) by boris
CVS tags: Version_3
Collection now works

    1: #!/usr/local/bin/perl
    2: #
    3: #$Id: collection.pl,v 1.4 2005/02/16 22:25:59 boris Exp $
    4: #
    5: # Собрание сочинений
    6: #
    7:     use Getopt::Std; 
    8: 
    9: $usage = 
   10: "Usage: collection.pl [-d] [-t table_file]  [-o results] \n";
   11: 
   12: require 'parameters.pl';
   13: require 'subroutines.pl';
   14: 
   15: die $usage unless getopts('t:o:d');
   16: 
   17: $DEBUG=$opt_d;
   18: 
   19: # Находим максимальный вопрос
   20: $MAXQUEST=1;
   21: for (my $i=1; $i<=$ROUNDS; $i++) {
   22:     if ($MAXQUEST<$MAXQUEST[$i]) {
   23: 	$MAXQUEST=$MAXQUEST[$i];
   24:     }
   25: }
   26: 
   27: 
   28: 
   29: my %teams;
   30: my @answers;
   31: #
   32: # Читаем старые результаты
   33: #
   34: if ($opt_t)
   35: {
   36:     die "Cannot open $opt_t\n" unless open(INFILE,$opt_t);
   37:     readhash(\@answers);
   38:     close(INFILE);
   39: }
   40: 
   41: #
   42: # Читаем ответы команд
   43: #
   44: for (my $i=1; $i<=$ROUNDS; $i++) {
   45:     foreach my $file (split /\s+/, $FILES[$i]) {
   46: 	open (INFILE, $file);
   47: 	readmail(\%teams);
   48: 	collect_answers(\%teams,\@answers);
   49: 	close (INFILE);
   50:     }
   51: }
   52: 
   53: # Пишем измененную таблицу в файл.
   54: #
   55: if ($opt_o)
   56: { 
   57:     die "Cannot open $opt_o\n" unless open(OUTFILE,">$opt_o");
   58:     select OUTFILE;
   59: }
   60: for ($i=1;$i<=$MAXQUEST;$i++)
   61: {
   62:     print "\nВОПРОС $i:\n";
   63:     print "\nЗАСЧИТАНО:\n";
   64:     anondump(\%teams,\@answers,$i,'+');
   65:     print "\nНЕ ЗАСЧИТАНО:\n";
   66:     anondump(\%teams,\@answers,$i,'-');
   67:     print "\nНЕ ЯСНО:\n";
   68:     anondump(\%teams,\@answers,$i,'?');
   69: }
   70: print "***\n";
   71: 
   72: 
   73: 
   74: 
   75: 
   76: 
   77: 

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