Date: Tuesday October 31, 2000 @ 23:51
Author: ahn
Update of /home/netrek/cvsroot/Vanilla/robots
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv1990
Modified Files:
inl.c inlcomm.c
Log Message:
* robots/inl*.c: Change continuous score differential to 2.0.
Remove debug messages. Flush out scores at end-game.
****************************************
Index: Vanilla/robots/inl.c
diff -u Vanilla/robots/inl.c:1.32 Vanilla/robots/inl.c:1.33
--- Vanilla/robots/inl.c:1.32 Tue Jun 27 18:04:48 2000
+++ Vanilla/robots/inl.c Tue Oct 31 23:51:43 2000
@@ -1,7 +1,7 @@
-/* $Id: inl.c,v 1.32 2000/06/27 23:04:48 ahn Exp $ */
+/* $Id: inl.c,v 1.33 2000/11/01 05:51:43 ahn Exp $ */
#ifndef lint
-static char vcid[] = "$Id: inl.c,v 1.32 2000/06/27 23:04:48 ahn Exp $";
+static char vcid[] = "$Id: inl.c,v 1.33 2000/11/01 05:51:43 ahn Exp $";
#endif /* lint */
/*
@@ -121,8 +121,8 @@
Inl_countdown inl_countdown =
{0,{60,30,10,5,4,3,2,1,0,-1},8,0,PERSEC,NULL,""};
-int checkgeno();
int end_tourney();
+int checkgeno();
Inl_countdown inl_game =
{0,{2700,1800,600,300,120,60,30,10,5,4,3,2,1,0,-1},12,0,PERSEC,end_tourney,""};
@@ -148,11 +148,10 @@
void reset_inl(int);
int checkmess();
void inlmove();
-int end_tourney();
int start_tourney();
void reset_stats();
void update_scores();
-void announce_scores(int, int);
+void announce_scores(int, int, FILE *);
extern char *addr_mess(int who, int type);
@@ -655,7 +654,7 @@
/* announce updated scores every 5 minutes */
if ((inl_stat.game_ticks % (5 * PERMIN)) == 0)
- announce_scores(0, MALL);
+ announce_scores(0, MALL, NULL);
}
@@ -736,8 +735,8 @@
/* Determine if there is a winner at the end of regulation.
returns 0 if game is tied
returns 1 if there is a winner by planet count
- returns 2 if there is a winner by continuous score > 1.50
- returns 3 if there is a winner by continuous score < 1.50 & planet 11-8-1
+ returns 2 if there is a winner by continuous score > 2.0
+ returns 3 if there is a winner by continuous score < 2.0 & planet 11-8-1
-da
*/
int check_winner() {
@@ -771,11 +770,11 @@
if (delta < 0.0)
delta *= -1.0;
- /* if continuous score delta is >= 1.50, we have winner */
- if (delta >= 1.50)
+ /* if continuous score delta is >= 2.0, we have winner */
+ if (delta >= 2.0)
return 2;
- /* if continuous score delta is < 1.50, but a team has > 11-8-1,
+ /* if continuous score delta is < 2.0, but a team has > 11-8-1,
we have a winner */
else if ((inl_teams[HOME].planets > inl_teams[AWAY].planets + 2) ||
(inl_teams[AWAY].planets > inl_teams[HOME].planets + 2))
@@ -798,23 +797,35 @@
pmessage(0, MALL, inl_from, "Result: %i - %i - %i",
inl_teams[HOME].planets, inl_teams[AWAY].planets,
(20 - inl_teams[HOME].planets - inl_teams[AWAY].planets));
- announce_scores(0, MALL);
+ /* need to write this to the inl_log because the pmessages don't
+ get flushed out to the log before the close */
+ fprintf(inl_log, "----------- Game Over ------------\n");
+ fprintf(inl_log, "Result: %i - %i - %i\n",
+ inl_teams[HOME].planets, inl_teams[AWAY].planets,
+ (20 - inl_teams[HOME].planets - inl_teams[AWAY].planets));
+
+ announce_scores(0, MALL, inl_log);
+
switch(win_cond) {
case 1:
pmessage(0, MALL, inl_from, "Winning condition: planet count");
+ fprintf(inl_log, "Winning condition: planet count\n");
break;
case 2:
- pmessage(0, MALL, inl_from, "Winning condition: continuous score >= 1.5");
+ pmessage(0, MALL, inl_from, "Winning condition: continuous score >= 2.0");
+ fprintf(inl_log, "Winning condition: continuous score >= 2.0\n");
break;
case 3:
- pmessage(0, MALL, inl_from, "Winning condition: score < 1.5, planet count");
+ pmessage(0, MALL, inl_from, "Winning condition: score < 2.0, planet count");
+ fprintf(inl_log, "Winning condition: score < 2.0, planet count\n");
break;
default:
pmessage(0, MALL, inl_from, "Winning condition: UNKNOWN");
+ fprintf(inl_log, "Winning condition: UNKNOWN\n");
break;
}
-
+
game_over = 1;
}
Index: Vanilla/robots/inlcomm.c
diff -u Vanilla/robots/inlcomm.c:1.17 Vanilla/robots/inlcomm.c:1.18
--- Vanilla/robots/inlcomm.c:1.17 Tue Jun 27 18:04:48 2000
+++ Vanilla/robots/inlcomm.c Tue Oct 31 23:51:43 2000
@@ -1031,7 +1031,7 @@
return 1;
}
-void announce_scores(int who, int flag) {
+void announce_scores(int who, int flag, FILE *fp) {
int win_cond;
float divisor = (float) (inl_stat.game_ticks * 4);
@@ -1049,7 +1049,15 @@
(float) inl_teams[0].weighted_score / inl_stat.weighted_divisor,
(float) inl_teams[1].weighted_score / inl_stat.weighted_divisor);
+ if (fp)
+ fprintf("Score: %s vs %s %.2f - %.2f (weighted)\n",
+ sides[inl_teams[0].side_index].name,
+ sides[inl_teams[1].side_index].name,
+ (float) inl_teams[0].weighted_score / inl_stat.weighted_divisor,
+ (float) inl_teams[1].weighted_score / inl_stat.weighted_divisor);
+
+ /***** no need for these debug statements -da
if (divisor < 1.0f)
divisor = 1.0f;
@@ -1072,6 +1080,8 @@
(float) inl_teams[0].semi_score / divisor,
(float) inl_teams[1].semi_score / divisor);
+ ******/
+
if ((win_cond = check_winner()) != 0) {
@@ -1087,22 +1097,29 @@
break;
case 2:
pmessage(who, flag, addr_mess(who, flag),
- "%s is winning by score >= 1.5", side);
+ "%s is winning by score >= 2.0", side);
+ if (fp)
+ fprintf(fp, "%s is winning by score >= 2.0\n", side);
break;
case 3:
pmessage(who, flag, addr_mess(who, flag),
- "%s is winning by score < 1.5 but planet > 11-8-1 ", side);
+ "%s is winning by score < 2.0 but planet > 11-8-1", side);
+ if (fp)
+ fprintf(fp, "%s is winning by score < 2.0 but planet > 11-8-1\n", side);
break;
}
}
- else
+ else {
pmessage(who, flag, addr_mess(who, flag), "Game is tied.");
+ if (fp)
+ fprintf(fp, "Game is tied\n");
+ }
}
int do_cscore(char *comm, struct message *mess) {
- announce_scores(mess->m_from, MINDIV);
+ announce_scores(mess->m_from, MINDIV, NULL);
return 1;
}