From: Martin Mares Date: Sat, 23 Mar 2013 10:43:50 +0000 (+0100) Subject: MOP: Score generator replaced by exporting of points X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=e3a38d4370c2492a000e197930c1339d9eb860ef;p=eval.git MOP: Score generator replaced by exporting of points --- diff --git a/mop/score/Makefile b/mop/score/Makefile index 336e996..db1fb75 100644 --- a/mop/score/Makefile +++ b/mop/score/Makefile @@ -2,7 +2,6 @@ # (c) 2008 Martin Mares DIRS+=mop/score -PROGS+=$(addprefix $(o)/mop/score/,mo-score-mop mo-score-mop-formatted) +PROGS+=$(addprefix $(o)/mop/score/,mo-score-mop) -$(o)/mop/score/mo-score-mop-formatted: $(s)/mop/score/mo-score-mop-formatted.sh $(o)/mop/score/mo-score-mop: $(s)/mop/score/mo-score-mop.sh diff --git a/mop/score/listina.ftr b/mop/score/listina.ftr deleted file mode 100644 index 3e38439..0000000 --- a/mop/score/listina.ftr +++ /dev/null @@ -1,3 +0,0 @@ -}}} - -\bye diff --git a/mop/score/listina.hdr b/mop/score/listina.hdr deleted file mode 100644 index 460ff42..0000000 --- a/mop/score/listina.hdr +++ /dev/null @@ -1,30 +0,0 @@ -\language=\czech -\frenchspacing -\font\head=csr12 scaled \magstephalf -\font\hexx=csti12 -\font\xxit=csti10 -\def\xit{\xxit\kern-0.1em\relax} -\let\hb=\relax -\parindent=0pt -\nopagenumbers - -\centerline{\head Výsledková listina ústøedního kola 58. roèníku MO kategorie P} -\bigskip -\centerline{\hexx 25. -- 27. bøezna 2009 v Plzni} -\bigskip -\bigskip - -\hrule -\bigskip - -\centerline{\vbox{\halign{% -#\hfil &~~~~#\hfil &~~~ #\hfil &~~~~#\hfil&\quad -\hfil # ~& -\hfil # ~~& -\hfil # ~~& -\hfil # ~& -\hfil # ~& \kern1em -\hb\quad\hfil # \cr -\noalign{\bigskip\bigskip\hbox{\xit Vítìzové}\bigskip} -%\noalign{\bigskip\bigskip\hbox{\xit Úspì¹ní øe¹itelé}\bigskip} -%\noalign{\bigskip\bigskip\hbox{\xit Ostatní úèastníci}\bigskip} diff --git a/mop/score/mo-score-mop-formatted.sh b/mop/score/mo-score-mop-formatted.sh deleted file mode 100755 index 44e956b..0000000 --- a/mop/score/mo-score-mop-formatted.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -mop/mo-score-mop 3 2 policie rybka | column -c120 -ts" " | cstocs il2 ascii diff --git a/mop/score/mo-score-mop.sh b/mop/score/mo-score-mop.sh index 44944a5..d7aca2e 100755 --- a/mop/score/mo-score-mop.sh +++ b/mop/score/mo-score-mop.sh @@ -1,63 +1,27 @@ #!/usr/bin/perl - +use strict; +use warnings; use List::Util qw(min); -$tex = 0; -$usage = "Usage: mo-score-mop [--tex] theoretical_tasks_nr praxis_tasks_nr task1 task2 ..."; -while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) { - shift @ARGV; - $var = "\$$1"; - if (!eval "defined $var") { die $usage; } - eval "$var = 1;"; -} -@ARGV >=2 || die $usage; -$theory=shift @ARGV; -$praxis=shift @ARGV; -@ARGV >= $praxis || die $usage; -$pos_delim=$tex ? '--' : '-'; +@ARGV or die "Usage: mo-score-mop task1 task2 ..."; print STDERR "Scanning contestants... "; open (CT, "bin/mo-get-users --full |") || die "Cannot get list of contestants"; +my %users = (); while () { chomp; - ($u,$f) = split /\t/; - ($u eq "somebody") && next; - $users{$u}=$f; + my ($u, $f) = split /\t/; + $u =~ /^mo/ or next; + $users{$u}=$f; } close CT; print STDERR 0+keys %users, "\n"; -print STDERR "Scanning teoretical results... "; -if (open (EX, "teorie.txt")) { - while () { - chomp; - (/^$/ || /^#/) && next; - @a = split /\ *\t\ */; - $u = shift @a; - defined $users{$u} || die "Unknown user $u"; - $names{$u} = shift @a; - $forms{$u} = shift @a; - $addresses{$u} = "{". (shift @a) ."}"; - $i=0; - while (@a) { $tasks{$u}{$i} = shift @a;$i++; } - } - close EX; - print STDERR "OK\n"; -} else {die "none, cannot find file teorie.txt!\n";} - print STDERR "Scanning task results... "; -$need_tasks = join("|", @ARGV); -foreach $u (keys %users) { - opendir (D, "testing/$u") or next; - foreach $t (readdir(D)) { - $t =~ /^\./ && next; - $t =~ /$need_tasks/ || next; - - $t_num=$praxis; - for (my $t_num2=0;$t_num2<@ARGV;$t_num2++) {if ($t eq $ARGV[$t_num2]) {$t_num=$t_num2;}} - $t_num+=$theory; - - $tt = "testing/$u/$t/points"; +my %tasks = (); +for my $u (keys %users) { + for my $t (@ARGV) { + my $tt = "testing/$u/$t/points"; -f $tt || next; print STDERR "$u/$t "; open (X, $tt) || die "Unable to open $tt"; @@ -76,76 +40,15 @@ foreach $u (keys %users) { close X; for my $g (keys %groups) { - $tasks{$u}{$t_num} += $groups{$g}; + $tasks{$u}{$t} += $groups{$g}; } } - closedir D; } print STDERR "OK\n"; -print STDERR "Creating table template... "; -@body = ('','$names{$u}','$forms{$u}','$addresses{$u}'); -for ($a=0;$a<$theory+$praxis;$a++) {push @body,"\$tasks{\$u}{$a}";} -print STDERR "OK\n"; - -print STDERR "Filling in results... "; -@table = (); -foreach $u (keys %users) { - next unless defined $names{$u}; # don't show any user not defined in teorie.txt - $row = []; - $row_index=0; - $row_sum=0; - foreach my $c (@body) { - $c =~ s/\$(\d+)/\$\$row[$1]/g; - $x = eval $c; - push @$row, (defined $x ? $x : '-'); - if ($row_index>3) { - if ((defined $x) && ($x>0)) {$row_sum+=$x;} - } - $row_index++; - } - push @$row, $row_sum; - push @table, $row; -} -print STDERR "OK\n"; - -print STDERR "Sorting... "; -$sortcol = @{$table[0]} - 1; -$namecol = 1; -@table = sort { - my $p, $an, $bn; - $p = $$b[$sortcol] <=> $$a[$sortcol]; - ($an = $$a[$namecol]) =~ s/(\S+)\s+(\S+)/$2 $1/; - ($bn = $$b[$namecol]) =~ s/(\S+)\s+(\S+)/$2 $1/; - $p ? $p : ($an cmp $bn); -} @table; -$i=0; -while ($i < @table) { - $j = $i; - while ($i < @table && ${$table[$i]}[$sortcol] == ${$table[$j]}[$sortcol]) { - $i++; - } - if ($i == $j+1) { - ${table[$j]}[0] = "$i."; - } else { - ${table[$j]}[0] = $j+1 . '.' . $pos_delim . $i . "."; - $j_old=$j; - $j++; - while ($j < $i) { ${table[$j++]}[0] = $j_old+1 . '.' . $pos_delim . $i . "."; }; - } +print STDERR "Generating output... "; +for my $u (sort keys %users) { + print join("\t", $u, $users{$u}, map { $tasks{$u}{$_} // '-' } @ARGV), "\n"; } print STDERR "OK\n"; -if ($tex) { - open HDR,"listina.hdr" or die "Cannot open file listina.hdr with TeX template!"; - while () {print; } - close HDR; - - foreach $r (@table) { print join('&',@$r), "\\cr\n";} - - open FTR,"listina.ftr" or die "Cannot open file listina.ftr with TeX template!"; - while () {print; } - close FTR; -} else { - foreach $r (@table) { print join("\t",@$r), "\n"; } -} diff --git a/mop/score/teorie.txt b/mop/score/teorie.txt deleted file mode 100644 index f1b78e1..0000000 --- a/mop/score/teorie.txt +++ /dev/null @@ -1,29 +0,0 @@ -mo01 Karolína Bure¹ová 6/8 G Èeská Lípa 0 2 7 -mo02 Milan Cejnar 8/8 G Turnov 5 4 5 -mo03 Petr Èermák 7/8 G Kladno 4 10 7 -mo04 Vlastimil Dort 7/8 G ©pitálská, Praha 9 5 10 6 -mo05 Franti¹ek Hejl 6/6 G Jana Nerudy, Praha 1 4 5 7 -mo06 Martin Holeèek 7/8 G Mikulá¹ské nám., Plzeò 4 9 7 -mo07 Ondøej Holý 8/8 G Josefa Ressela, Chrudim 6 10 7 -mo08 Hynek Jemelík 2/4 G tø. Kpt. Jaro¹e, Brno 5 10 6 -mo09 David Kla¹ka 7/8 G tø. Kpt. Jaro¹e, Brno 7 10 6 -mo10 Miroslav Klimo¹ 4/4 G M. Koperníka, Bílovec 5 10 7 -mo11 Michal Koutný 8/8 G Tøebíè 2 10 4 -mo12 Karel Král 7/8 Podkru¹nohorské G, Most 5 2 7 -mo13 Luká¹ Kripner 7/8 G T. G. Masaryka, Litvínov 4 10 7 -mo14 Vojtìch Kudrnáè 8/8 G Turnov 4 2 3 -mo15 Jan Matìjka 8/8 G Jírovcova, Èeské Budìjovice 5 2 6 -mo16 Antoník Novák 3/4 G Arabská, Praha 6 5 2 4 -mo17 Jitka Novotná 4/4 G M. Koperníka, Bílovec 4 10 7 -mo18 Martin Patera 3/4 G Arabská, Praha 6 2 1 7 -mo19 Ondøej Pelech 6/6 G Jana Nerudy, Praha 1 5 2 7 -mo20 Libor Plucnar 6/6 G Petra Bezruèe, Frýdek-Místek 4 10 7 -mo21 Jan Polá¹ek 6/8 G Turnov 6 2 7 -mo23 Jiøí Setnièka 4/6 G Èakovice, Praha 9 2 2 7 -mo24 Alexander Slávik 8/8 G Brno-Øeèkovice 5 2 7 -mo25 Karel Tesaø 3/4 VO© a SP©E Plzeò 1 10 7 -mo26 Jan Tichý 4/4 G Pardubice 2 0 3 -mo27 Pavel Veselý 4/4 G Strakonice 6 6 7 -mo28 Tomá¹ Vítek 3/4 G Arabská, Praha 6 2 1 4 -mo29 David Vondrák 7/8 G Pardubice 4 1 4 -mo30 Martin Zikmund 5/8 G Turnov 4 2 1 diff --git a/mop/score/vysledky.tex b/mop/score/vysledky.tex deleted file mode 100644 index 8b412e1..0000000 --- a/mop/score/vysledky.tex +++ /dev/null @@ -1,63 +0,0 @@ -\language=\czech -\frenchspacing -\font\head=csr12 scaled \magstephalf -\font\hexx=csti12 -\font\xxit=csti10 -\def\xit{\xxit\kern-0.1em\relax} -\let\hb=\relax -\parindent=0pt -\nopagenumbers - -\centerline{\head Výsledková listina ústøedního kola 56. roèníku MO kategorie P} -\bigskip -\centerline{\hexx 21. -- 24. bøezna 2007 ve Zlínì} -\bigskip -\bigskip - -\hrule -\bigskip - -\centerline{\vbox{\halign{% -#\hfil &~~#\hfil &\quad #\hfil &~~#\hfil&\quad -\hfil # & -\hfil # & -\hfil # & \kern0.4em -\hfil # & -\hfil # & \kern1em -\hb\quad\hfil # \cr -\noalign{\bigskip\bigskip\hbox{\xit Vítìzové}\bigskip} -%\noalign{\bigskip\bigskip\hbox{\xit Úspì¹ní øe¹itelé}\bigskip} -%\noalign{\bigskip\bigskip\hbox{\xit Ostatní úèastníci}\bigskip} -1.&Josef Pihera&8/8&{G Máchova, Strakonice}&7&4&10&15&15&51\cr -2.&Pavel Klavík&8/8&{G J. Ressla, Chrudim}&0&4&10&15&12&41\cr -3.&Roman Smr¾&7/8&{G E. Krásnohorské, Praha}&6&3&10&0&13&32\cr -4.&Miroslav Klimo¹&2/4&{G M. Koperníka, Bílovec}&9&9&10&2&0&30\cr -5.&Luká¹ Lánský&3/4&{G J. K. Tyla, Hradec Králové}&3&5&10&0&0&18\cr -6.&Pavel Motloch&6/6&{G P. Bezruèe, Frýdek-Místek}&0&7&10&0&0&17\cr -7.&Jakub Kaplan&3/4&{G J. K. Tyla, Hradec Králové}&5&3&1&7&0&16\cr -8.&Martin Pokorný&4/4&{G Arabská, Praha}&3&2&9&1&-&15\cr -9.&Martin Milata&8/8&{G Hladnovská, Ostrava}&0&2&8&0&4&14\cr -10.&Libor Peltan&7/8&{G Èeská, Èeské Budìjovice}&0&0&10&3&-&13\cr -11.&Ondøej Piálek&4/4&{G Masarykovo nám., Tøebíè}&7&1&1&0&3&12\cr -12.&Petr Dluho¹&8/8&{Mendelovo G, Opava}&0&0&10&0&1&11\cr -13.&Petr Kratochvíl&4/4&{G Sázavská, Svìtlá nad Sázavou}&1&1&6&1&-&9\cr -14.&Pavel John&4/4&{G Arabská, Praha}&0&1&7&-&0&8\cr -15.&Marek Scholle&8/8&{G Da¹ická, Pardubice}&6&1&0&0&-&7\cr -16.&Ondøej Bouda&8/8&{G Tø. Kpt. Jaro¹e, Brno}&1&3&0&2&0&6\cr -17.&Tomá¹ Toufar&3/4&{G M. Koperníka, Bílovec}&0&3&0&2&0&5\cr -18.--19.&Tomá¹ Pøaslièák&7/8&{GOA Nádra¾ní, Sedlèany}&0&3&1&-&0&4\cr -18.--19.&Martin Ve¹krna&4/4&{G Vídeòská, Brno}&0&3&1&-&-&4\cr -20.--25.&Jakub Balhar&6/6&{G J. Nerudy, Praha}&1&1&1&-&0&3\cr -20.--25.&Roman Diba&3/4&{VO© a SP©E Plzeò}&0&0&1&2&-&3\cr -20.--25.&Filip Dìchtìrenko&8/8&{G J. Masaryka, Jihlava}&0&1&1&0&1&3\cr -20.--25.&Matìj Korvas&8/8&{G J. Seiferta, Praha}&0&2&1&-&0&3\cr -20.--25.&Tomá¹ Køen&4/4&{G Ch. Dopplera, Praha}&0&3&0&-&-&3\cr -20.--25.&Michal Pavelèík&8/8&{G J. A. Komenského, Uherský Brod}&0&0&0&0&3&3\cr -26.--28.&Zuzana Bure¹ová&8/8&{Masarykovo G, Plzeò}&0&1&1&0&-&2\cr -26.--28.&Michal Novák&8/8&{G Tø. Kpt. Jaro¹e, Brno}&0&0&2&-&-&2\cr -26.--28.&Libor Plucnar&4/6&{G P. Bezruèe, Frýdek-Místek}&0&1&1&0&-&2\cr -29.&Roman Øíha&7/8&{G Zlatá stezka, Prachatice}&0&1&0&-&0&1\cr -30.&Michal Minaøík&4/4&{G F. X. ©aldy, Liberec}&0&0&0&-&-&0\cr -}}} - -\bye diff --git a/mop/score/vysledky.txt b/mop/score/vysledky.txt deleted file mode 100644 index fdbe89c..0000000 --- a/mop/score/vysledky.txt +++ /dev/null @@ -1,30 +0,0 @@ -1. Josef Pihera 8/8 {G Machova, Strakonice} 7 4 10 15 15 51 -2. Pavel Klavik 8/8 {G J. Ressla, Chrudim} 0 4 10 15 12 41 -3. Roman Smrz 7/8 {G E. Krasnohorske, Praha} 6 3 10 0 13 32 -4. Miroslav Klimos 2/4 {G M. Kopernika, Bilovec} 9 9 10 2 0 30 -5. Lukas Lansky 3/4 {G J. K. Tyla, Hradec Kralove} 3 5 10 0 0 18 -6. Pavel Motloch 6/6 {G P. Bezruce, Frydek-Mistek} 0 7 10 0 0 17 -7. Jakub Kaplan 3/4 {G J. K. Tyla, Hradec Kralove} 5 3 1 7 0 16 -8. Martin Pokorny 4/4 {G Arabska, Praha} 3 2 9 1 - 15 -9. Martin Milata 8/8 {G Hladnovska, Ostrava} 0 2 8 0 4 14 -10. Libor Peltan 7/8 {G Ceska, Ceske Budejovice} 0 0 10 3 - 13 -11. Ondrej Pialek 4/4 {G Masarykovo nam., Trebic} 7 1 1 0 3 12 -12. Petr Dluhos 8/8 {Mendelovo G, Opava} 0 0 10 0 1 11 -13. Petr Kratochvil 4/4 {G Sazavska, Svetla nad Sazavou} 1 1 6 1 - 9 -14. Pavel John 4/4 {G Arabska, Praha} 0 1 7 - 0 8 -15. Marek Scholle 8/8 {G Dasicka, Pardubice} 6 1 0 0 - 7 -16. Ondrej Bouda 8/8 {G Tr. Kpt. Jarose, Brno} 1 3 0 2 0 6 -17. Tomas Toufar 3/4 {G M. Kopernika, Bilovec} 0 3 0 2 0 5 -18.-19. Tomas Praslicak 7/8 {GOA Nadrazni, Sedlcany} 0 3 1 - 0 4 -18.-19. Martin Veskrna 4/4 {G Videnska, Brno} 0 3 1 - - 4 -20.-25. Jakub Balhar 6/6 {G J. Nerudy, Praha} 1 1 1 - 0 3 -20.-25. Roman Diba 3/4 {VOS a SPSE Plzen} 0 0 1 2 - 3 -20.-25. Filip Dechterenko 8/8 {G J. Masaryka, Jihlava} 0 1 1 0 1 3 -20.-25. Matej Korvas 8/8 {G J. Seiferta, Praha} 0 2 1 - 0 3 -20.-25. Tomas Kren 4/4 {G Ch. Dopplera, Praha} 0 3 0 - - 3 -20.-25. Michal Pavelcik 8/8 {G J. A. Komenskeho, Uhersky Brod} 0 0 0 0 3 3 -26.-28. Zuzana Buresova 8/8 {Masarykovo G, Plzen} 0 1 1 0 - 2 -26.-28. Michal Novak 8/8 {G Tr. Kpt. Jarose, Brno} 0 0 2 - - 2 -26.-28. Libor Plucnar 4/6 {G P. Bezruce, Frydek-Mistek} 0 1 1 0 - 2 -29. Roman Riha 7/8 {G Zlata stezka, Prachatice} 0 1 0 - 0 1 -30. Michal Minarik 4/4 {G F. X. Saldy, Liberec} 0 0 0 - - 0