/usr/games often isn't in root's path
[unix-history] / usr / src / games / trek / score.c
CommitLineData
bb0cfa24
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
e9fb6bea
KB
3 * All rights reserved.
4 *
b2e7427f 5 * %sccs.include.redist.c%
bb0cfa24
DF
6 */
7
86f0906d 8#ifndef lint
b2e7427f 9static char sccsid[] = "@(#)score.c 5.4 (Berkeley) %G%";
e9fb6bea 10#endif /* not lint */
86f0906d
KM
11
12# include "trek.h"
13# include "getpar.h"
14
15/*
16** PRINT OUT THE CURRENT SCORE
17*/
18
19long score()
20{
21 register int u;
22 register int t;
23 long s;
24 double r;
25 extern struct cvntab Skitab[];
26
27 printf("\n*** Your score:\n");
28 s = t = Param.klingpwr / 4 * (u = Game.killk);
29 if (t != 0)
30 printf("%d Klingons killed\t\t\t%6d\n", u, t);
31 r = Now.date - Param.date;
32 if (r < 1.0)
33 r = 1.0;
34 r = Game.killk / r;
35b95499 35 s += (t = 400 * r);
86f0906d
KM
36 if (t != 0)
37 printf("Kill rate %.2f Klingons/stardate \t%6d\n", r, t);
38 r = Now.klings;
35b95499
KL
39 r /= Game.killk + 1;
40 s += (t = -400 * r);
86f0906d
KM
41 if (t != 0)
42 printf("Penalty for %d klingons remaining\t%6d\n", Now.klings, t);
43 if (Move.endgame > 0)
44 {
35b95499 45 s += (t = 100 * (u = Game.skill));
86f0906d
KM
46 printf("Bonus for winning a %s%s game\t\t%6d\n", Skitab[u - 1].abrev, Skitab[u - 1].full, t);
47 }
48 if (Game.killed)
49 {
35b95499 50 s -= 500;
86f0906d
KM
51 printf("Penalty for getting killed\t\t -500\n");
52 }
35b95499 53 s += (t = -100 * (u = Game.killb));
86f0906d
KM
54 if (t != 0)
55 printf("%d starbases killed\t\t\t%6d\n", u, t);
35b95499 56 s += (t = -100 * (u = Game.helps));
86f0906d
KM
57 if (t != 0)
58 printf("%d calls for help\t\t\t%6d\n", u, t);
35b95499 59 s += (t = -5 * (u = Game.kills));
86f0906d
KM
60 if (t != 0)
61 printf("%d stars destroyed\t\t\t%6d\n", u, t);
35b95499 62 s += (t = -150 * (u = Game.killinhab));
86f0906d
KM
63 if (t != 0)
64 printf("%d inhabited starsystems destroyed\t%6d\n", u, t);
65 if (Ship.ship != ENTERPRISE)
66 {
35b95499 67 s -= 200;
86f0906d
KM
68 printf("penalty for abandoning ship\t\t -200\n");
69 }
35b95499 70 s += (t = 3 * (u = Game.captives));
86f0906d
KM
71 if (t != 0)
72 printf("%d Klingons captured\t\t\t%6d\n", u, t);
35b95499 73 s += (t = -(u = Game.deaths));
86f0906d
KM
74 if (t != 0)
75 printf("%d casualties\t\t\t\t%6d\n", u, t);
76 printf("\n*** TOTAL\t\t\t%14ld\n", s);
77 return (s);
78}