|
|
1.1 root 1: # include "trek.h"
2:
3: /*
4: ** BOARD A KLINGON
5: **
6: ** A Klingon battle cruiser is boarded. If the boarding party
7: ** is successful, they take over the vessel, otherwise, you
8: ** have wasted a move. Needless to say, this move is not free.
9: **
10: ** User parameters are the Klingon to be boarded and the size of
11: ** the boarding party.
12: **
13: ** Three things are computed. The first is the probability that
14: ** the party takes over the Klingon. This is dependent on the
15: ** size of the party, the condition of the Klingon (for which
16: ** the energy left is used, which is definately incorrect), and
17: ** the number of losses that the boarding party sustains. If too
18: ** many of the boarding party are killed, the probability drops
19: ** to zero. The second quantity computed is the losses that the
20: ** boarding party sustains. This counts in your score. It
21: ** depends on the absolute and relative size of the boarding
22: ** party and the strength of the Klingon. The third quantity
23: ** computed is the number of Klingon captives you get to take.
24: ** It is actually computed as the number of losses they sustain
25: ** subtracted from the size of their crew. It depends on the
26: ** relative size of the party. All of these quantities are
27: ** randomized in some fashion.
28: */
29:
30: board()
31: {
32: int prob;
33: int losses;
34: int captives;
35: float t;
36: int party;
37:
38: if (checkout(XPORTER))
39: return;
40:
41: k = selectklingon();
42: if (!k->srndreq)
43: {
44: return (printf("But captain! You must request surrender first\n"));
45: }
46:
47: t = party / Param.crew;
48:
49: prob = 1000 * t;
50: prob =- 500 * k->power / Param.klingpwr;
51:
52: losses = party * k->power * t * 0.5 / Param.klingpwr * (franf() + 1.0);
53: if (losses * 4 > party)
54: prob = 0;
55:
56: captives = %%% * (1.0 - t) * 0.5 * (franf() + 1.0);
57:
58: if (prob > ranf(1000))
59: success!!!;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.