/*
* deal -- compute combination probabilities for card draws
*
- * ($Id: deal.c,v 1.20 1995/04/17 11:44:49 esr Exp esr $)
+ * ($Id: deal.c,v 1.21 1996/09/26 22:30:35 esr Exp esr $)
*
* Based on the `cardprobs' program written by Jeremy C. York
* <jeremy@stat.cmu.edu> in September 1993; cleanup, comments,
* generalization, and interface improvements by Eric Raymond
- * <esr@snark.thyrsus.com> in April 1995.
+ * <esr@snark.thyrsus.com> in April 1995. The -g and -w options
+ * were added by esr September 1996.
*
* If I have M special cards in my deck, and N total cards in my deck,
* and I draw k cards from that deck (*without replacement* -- the
-.TH DEAL 1 "April 12, 1995"
+.TH DEAL 1 "September 27, 1996"
.SH NAME
deal \- compute and display deal probabilities
.SH SYNOPSIS
-.B deal [-h] [-b base] [-t turns] [-c columns] specials total
+.B deal [-h] [-b base] [-t turns] [-c columns] [-g] [-w] specials total
.SH DESCRIPTION
This program prints out tables of non-replacement draw probabilities,
rounded to the nearest percent.
B(n,m) = n!/(m! * (n-m)!)
+where n! is the factorial function n! = 1 * 2 * 3 * ... * n.
+.PP
This program prints out tables of these probabilities. The `specials'
and `total' arguments specify M and N. The table displays values for
ranges of k and i.
Number of cards to assume in the initial hand. Note: this defaults to
7, \fBnot\fB to 0!
.TP 10
+-g
+Normally, the program displays the probability that you will have
+\fIexactly\fR a given number of specials. With this option, it
+displays the odds that you will have the given number of specials
+\fIor more\fR. This option also forces -w on, to accomodate 100%
+probabilities which will show up in column 0 if nowhere else.
+.TP 10
+-w
+Force wide display (3 chars per percentage) to accommodate 100% probabilities.
+.TP 10
-c
-Number of columns to generate in the report.
+Number of table columns to generate in the report. Defaults to the
+number of specials plus one additional to accommodate the zero column.
.TP 10
-h
Suppress table headers and legends.
deal -b 5 4 52
.SH BUGS
-100% probabilities can mess up the table formatting.
+The -w and -g options widen the column width of the tables to
+accommodate 100% probabilities, at the cost of making the table too
+wide to display on an 80-column terminal when the number of specials
+is more than 17. When wide display is off, on the other hand, 23
+specials will fit in 80 colums, but 100% probabilities can mess up the
+table formatting.
.SH AUTHOR
Eric S. Raymond <esr@snark.thyrsus.com>. Based on the `cardprobs'
program by Jeremy York. See my home page at
http://www.ccil.org/~esr/home.html for updates and other resources.
+