* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)capture.c 5.1 (Berkeley) %G%";
** Ask a Klingon To Surrender
** The Subspace Radio is needed to ask a Klingon if he will kindly
** surrender. A random Klingon from the ones in the quadrant is
** The Klingon is requested to surrender. The probability of this
** is a function of that Klingon's remaining power, our power,
register struct kling
*k
;
extern struct kling
*selectklingon();
/* check for not cloaked */
printf("Ship-ship communications out when cloaked\n");
/* find out if there are any at all */
printf("Uhura: Getting no response, sir\n");
/* if there is more than one Klingon, find out which one */
/* check out that Klingon */
x
/= k
->power
* Etc
.nkling
;
printf("Prob = %d (%.4f)\n", i
, x
);
/* guess what, he surrendered!!! */
printf("Klingon at %d,%d surrenders\n", k
->x
, k
->y
);
i
= ranf(Param
.klingcrew
);
printf("%d klingons commit suicide rather than be taken captive\n", Param
.klingcrew
- i
);
printf("%d captives taken\n", i
);
/* big surprise, he refuses to surrender */
printf("Fat chance, captain\n");
** Cruddy, just takes one at random. Should ask the captain.
struct kling
*selectklingon()
return (&Etc
.klingon
[i
]);