* Copyright (c) 1980 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted provided
* that: (1) source distributions retain this entire copyright notice and
* comment, and (2) distributions including binaries display the following
* acknowledgement: ``This product includes software developed by the
* University of California, Berkeley and its contributors'' in the
* documentation or other materials provided with the distribution and in
* all advertising materials mentioning features or use of this software.
* Neither the name of the University nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
static char sccsid
[] = "@(#)capture.c 5.4 (Berkeley) 6/1/90";
** 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
]);