#include <signal.h>
#define BASEHAND 7 /* # cards in initial deal */
+#define TURNS_DEFAULT 20 /* show this many turns if total is greater */
static int sx, sk, sM, sN;
int turns, special, total, columns, i, j;
double hyper_prob();
- if (argc == 1) {
+ if (argc < 3) {
(void) printf("usage: cardprobs M N [t] [c]\n");
(void) printf(" M = # special cards\n");
(void) printf(" N = # total cards\n");
(void) printf(" t = # of turns (optional)\n");
- (void) printf(" c = columns in the report (optional).\n");
- (void) printf("No arguments are optional.\n");
+ (void) printf(" c = columns in the report (optional)\n");
} else {
special = atoi(argv[1]);
total = atoi(argv[2]);
exit(-1);
}
- turns = 20; /* fill a standard screen */
+
+ if (total - BASEHAND < TURNS_DEFAULT)
+ turns = total - BASEHAND;
+ else
+ turns = TURNS_DEFAULT;
+
if (argc >= 4)
turns = atoi(argv[3]);
if (turns > total - BASEHAND) {