|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted provided ! 6: * that: (1) source distributions retain this entire copyright notice and ! 7: * comment, and (2) distributions including binaries display the following ! 8: * acknowledgement: ``This product includes software developed by the ! 9: * University of California, Berkeley and its contributors'' in the ! 10: * documentation or other materials provided with the distribution and in ! 11: * all advertising materials mentioning features or use of this software. ! 12: * Neither the name of the University nor the names of its contributors may ! 13: * be used to endorse or promote products derived from this software without ! 14: * specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 16: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 17: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: */ ! 19: ! 20: #ifndef lint ! 21: static char sccsid[] = "@(#)score.c 5.4 (Berkeley) 6/1/90"; ! 22: #endif /* not lint */ ! 23: ! 24: # include "trek.h" ! 25: # include "getpar.h" ! 26: ! 27: /* ! 28: ** PRINT OUT THE CURRENT SCORE ! 29: */ ! 30: ! 31: long score() ! 32: { ! 33: register int u; ! 34: register int t; ! 35: long s; ! 36: double r; ! 37: extern struct cvntab Skitab[]; ! 38: ! 39: printf("\n*** Your score:\n"); ! 40: s = t = Param.klingpwr / 4 * (u = Game.killk); ! 41: if (t != 0) ! 42: printf("%d Klingons killed\t\t\t%6d\n", u, t); ! 43: r = Now.date - Param.date; ! 44: if (r < 1.0) ! 45: r = 1.0; ! 46: r = Game.killk / r; ! 47: s += (t = 400 * r); ! 48: if (t != 0) ! 49: printf("Kill rate %.2f Klingons/stardate \t%6d\n", r, t); ! 50: r = Now.klings; ! 51: r /= Game.killk + 1; ! 52: s += (t = -400 * r); ! 53: if (t != 0) ! 54: printf("Penalty for %d klingons remaining\t%6d\n", Now.klings, t); ! 55: if (Move.endgame > 0) ! 56: { ! 57: s += (t = 100 * (u = Game.skill)); ! 58: printf("Bonus for winning a %s%s game\t\t%6d\n", Skitab[u - 1].abrev, Skitab[u - 1].full, t); ! 59: } ! 60: if (Game.killed) ! 61: { ! 62: s -= 500; ! 63: printf("Penalty for getting killed\t\t -500\n"); ! 64: } ! 65: s += (t = -100 * (u = Game.killb)); ! 66: if (t != 0) ! 67: printf("%d starbases killed\t\t\t%6d\n", u, t); ! 68: s += (t = -100 * (u = Game.helps)); ! 69: if (t != 0) ! 70: printf("%d calls for help\t\t\t%6d\n", u, t); ! 71: s += (t = -5 * (u = Game.kills)); ! 72: if (t != 0) ! 73: printf("%d stars destroyed\t\t\t%6d\n", u, t); ! 74: s += (t = -150 * (u = Game.killinhab)); ! 75: if (t != 0) ! 76: printf("%d inhabited starsystems destroyed\t%6d\n", u, t); ! 77: if (Ship.ship != ENTERPRISE) ! 78: { ! 79: s -= 200; ! 80: printf("penalty for abandoning ship\t\t -200\n"); ! 81: } ! 82: s += (t = 3 * (u = Game.captives)); ! 83: if (t != 0) ! 84: printf("%d Klingons captured\t\t\t%6d\n", u, t); ! 85: s += (t = -(u = Game.deaths)); ! 86: if (t != 0) ! 87: printf("%d casualties\t\t\t\t%6d\n", u, t); ! 88: printf("\n*** TOTAL\t\t\t%14ld\n", s); ! 89: return (s); ! 90: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.