Annotation of 42BSD/games/trek/score.c, revision 1.1

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

unix.superglobalmegacorp.com

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