Vanilla Development Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS update: Vanilla/robots
Date: Wednesday March 22, 2000 @ 15:59
Author: karthik
Update of /home/netrek/cvsroot/Vanilla/robots
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv21905
Modified Files:
end_tourney.pl inl.c
Log Message:
Added cambot archiving, new dropdir format
****************************************
Index: Vanilla/robots/end_tourney.pl
diff -u Vanilla/robots/end_tourney.pl:1.8 Vanilla/robots/end_tourney.pl:1.9
--- Vanilla/robots/end_tourney.pl:1.8 Mon Jul 26 10:20:16 1999
+++ Vanilla/robots/end_tourney.pl Wed Mar 22 15:59:43 2000
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
#
-# $Id: end_tourney.pl,v 1.8 1999/07/26 15:20:16 ahn Exp $
+# $Id: end_tourney.pl,v 1.9 2000/03/22 21:59:43 karthik Exp $
#
# end_tourney.pl
#
@@ -35,6 +35,10 @@
#
#$dropsub = 1;
#
+# Uncomment this to use a more readable form for dropdir entries.
+#
+#$newdrop = 1;
+#
foreach $argument ( @ARGV ) {
if ( $argument eq "-register" ) {
@@ -48,16 +52,18 @@
$inputfile = "ltd_dump.txt." . $id;
$logfile = "INL_log." . $id;
$outputfile = "pwstats." . $id . ".html";
+ $cambotfile = "cambot.pkt." . $id;
} else {
$inputfile = "ltd_dump.txt";
$logfile = "INL_log";
$outputfile = "pwstats.html";
+ $cambotfile = "cambot.pkt";
}
- system("./tools/ltd_dump .players." . $id . " > $inputfile");
+system("./tools/ltd_dump .players." . $id . " > $inputfile");
- open (INPUT,"$inputfile");
- open (OUTPUT,">$outputfile");
+open (INPUT,"$inputfile");
+open (OUTPUT,">$outputfile");
$homecurrentplanets=10;
$awaycurrentplanets=10;
@@ -68,17 +74,39 @@
&printstdout;
&printstats;
+$hometeam =~ s/[\`\"\']//g;
+$awayteam =~ s/[\`\"\']//g;
+
if ( $dropdir ) {
if ( -d $dropdir ) {
if ( $dropsub ) {
- system("mkdir $dropdir/$id");
- system("cp -f $outputfile $dropdir/$id/pwstats.html");
- system("cp -f $logfile $dropdir/$id/INL_log");
- system("cp -f $inputfile $dropdir/$id/ltd_dump.txt");
- system("gzip -9f $dropdir/$id/INL_log");
- system("gzip -9f $dropdir/$id/ltd_dump.txt");
- system("chmod 755 $dropdir/$id");
- system("chmod 644 $dropdir/$id/*");
+ if ($newdrop) {
+ $neuts = 20 - $homecurrentplanets - $awaycurrentplanets;
+ if ($neuts == 0) {
+ $dirpath = "$dropdir/$hometeam -vs- $awayteam ($homecurrentplanets-$awaycurrentplanets)";
+ } else {
+ $dirpath = "$dropdir/$hometeam -vs- $awayteam ($homecurrentplanets-$awaycurrentplanets-$neuts)";
+ }
+ if ( -d $dirpath ) {
+ $dirnum = 2;
+ while ( -d "$dirpath [$dirnum]" ) {
+ $dirnum++;
+ }
+ $dirpath = "$dirpath [$dirnum]";
+ }
+ } else {
+ $dirpath = "$dropdir/$id";
+ }
+ umask 022;
+ system("mkdir \"$dirpath\"");
+ system("cp $outputfile \"$dirpath/pwstats.html\"");
+ system("gzip -9c $logfile > \"$dirpath/INL_log.gz\"");
+ system("gzip -9c $inputfile > \"$dirpath/ltd_dump.txt.gz\"");
+ if ( -f $cambotfile ) {
+ system("gzip -9c $cambotfile > \"$dirpath/cambot.pkt.gz\"");
+ }
+ system("chmod 755 \"$dirpath\"");
+ system("chmod 644 \"$dirpath\"/*");
} else {
system("cp -f $outputfile $dropdir/$outputfile");
}
@@ -95,7 +123,7 @@
sub computescore {
# After parsing stats, add up taken and destroyed planets for each
# team to figure out the score.
-
+
foreach $player ( sort keys %stat ) {
if ( $debug > 1 ) {
@@ -111,8 +139,12 @@
if ( $stat{$player}->{team} eq $homerace ) {
$homescore += $tpt + $tpd;
+ $homecurrentplanets += $tpt;
+ $awaycurrentplanets -= $tpd;
} else {
$awayscore += $tpt + $tpd;
+ $awaycurrentplanets += $tpt;
+ $homecurrentplanets -= $tpd;
}
if ( $debug > 1 ) {
print "Score: $homescore, $awayscore\n";
Index: Vanilla/robots/inl.c
diff -u Vanilla/robots/inl.c:1.26 Vanilla/robots/inl.c:1.27
--- Vanilla/robots/inl.c:1.26 Mon Nov 1 04:29:29 1999
+++ Vanilla/robots/inl.c Wed Mar 22 15:59:43 2000
@@ -1,7 +1,7 @@
-/* $Id: inl.c,v 1.26 1999/11/01 10:29:29 cameron Exp $ */
+/* $Id: inl.c,v 1.27 2000/03/22 21:59:43 karthik Exp $ */
#ifndef lint
-static char vcid[] = "$Id: inl.c,v 1.26 1999/11/01 10:29:29 cameron Exp $";
+static char vcid[] = "$Id: inl.c,v 1.27 2000/03/22 21:59:43 karthik Exp $";
#endif /* lint */
/*
@@ -709,6 +709,15 @@
sprintf(name, "%s.%d", N_GLOBAL, tv.tv_sec);
rename(N_GLOBAL, name);
+ /* Stop cambot. */
+ if (cambot_pid > 0) {
+ kill(cambot_pid, SIGTERM);
+ waitpid(cambot_pid, NULL, 0);
+ cambot_pid = 0;
+ sprintf(name, "%s.%d", Cambot_out, tv.tv_sec);
+ rename(Cambot_out, name);
+ }
+
for (c=0; c < INLTEAM; c++) {
if (inl_teams[c].flags & T_REGISTER) official++;
}
@@ -745,15 +754,6 @@
"Official registration script finished.");
}
}
- }
-
- /* Stop cambot. */
- if (cambot_pid > 0) {
- kill(cambot_pid, SIGTERM);
- waitpid(cambot_pid, NULL, 0);
- cambot_pid = 0;
- sprintf(name, "%s.%d", Cambot_out, tv.tv_sec);
- rename(Cambot_out, name);
}
reset_inl(1);