Annotation of researchv10no/games/trek/score.c, revision 1.1.1.1

1.1       root        1: # include      "trek.h"
                      2: 
                      3: /**
                      4:  **    print out the current score
                      5:  **/
                      6: 
                      7: long score()
                      8: {
                      9:        register int            u;
                     10:        long                    s, t;   /* should really be long */
                     11:        double                  r;
                     12:        extern CVNTAB   Skitab[];
                     13: 
                     14:        printf("\n*** Your score:\n");
                     15:        u = Initial.kling*1.05+5;
                     16:        if(u>Game.gkillk) u=Game.gkillk;
                     17:        s = t = Param.klingpwr / 4 * u;;
                     18:        if (t != 0)
                     19:                printf("%d Klingons killed\t\t\t%6D\n", Game.gkillk, t);
                     20:        r = Status.date - Initial.date;
                     21:        if (r < 1.0)
                     22:                r = 1.0;
                     23:        r = u / r;
                     24:        s =+ (t = 400 * r);
                     25:        if (t != 0)
                     26:                printf("Kill rate %.2f Klingons/stardate  \t%6D\n", r, t);
                     27:        r = Status.kling;
                     28:        r =/ u + 1;
                     29:        s =+ (t = -1000 * r);
                     30:        if (t != 0)
                     31:                printf("Penalty for %d klingons remaining\t%6D\n", Status.kling, t);
                     32:        if (Move.endgame > 0)
                     33:        {
                     34:                s =+ (t = 100 * (u = Game.skill));
                     35:                printf("Bonus for winning a %s%s game\t\t%6D\n", Skitab[u - 1].abrev, Skitab[u - 1].full, t);
                     36:        }
                     37:        if (Game.killed)
                     38:        {
                     39:                s =- 200;
                     40:                printf("Penalty for getting killed\t\t  -200\n");
                     41:        }
                     42:        s =+ (t = -100 * (u = Game.killb));
                     43:        if (t != 0)
                     44:                printf("%d starbases killed\t\t\t%6D\n", u, t);
                     45:        s =+ (t = -100 * (u = Game.helps));
                     46:        if (t != 0)
                     47:                printf("%d calls for help\t\t\t%6D\n", u, t);
                     48:        s =+ (t = -20 * (u = Game.kills));
                     49:        if (t != 0)
                     50:                printf("%d stars destroyed\t\t\t%6D\n", u, t);
                     51:        s =+ (t = -150 * (u = Game.killinhab));
                     52:        if (t != 0)
                     53:                printf("%d inhabited starsystems destroyed\t%6D\n", u, t);
                     54:        if (Status.ship != ENTERPRISE)
                     55:        {
                     56:                s =- 200;
                     57:                printf("penalty for abandoning ship\t\t  -200\n");
                     58:        }
                     59:        s =+ (t = 3 * (u = Game.captives));
                     60:        if (t != 0)
                     61:                printf("%d Klingons captured\t\t\t%6D\n", u, t);
                     62:        s =+ (t = -(u = Game.deaths));
                     63:        if (t != 0)
                     64:                printf("%d casualties\t\t\t\t%6D\n", u, t);
                     65:        printf("\n***  TOTAL\t\t\t\t%6D\n", s);
                     66:        return (s);
                     67: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.