]> thyrsus.com Git - deal.git/commitdiff
Add -g and -w options.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 26 Sep 1996 22:31:22 +0000 (22:31 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 26 Sep 1996 22:31:22 +0000 (22:31 +0000)
deal.c
deal.xml

diff --git a/deal.c b/deal.c
index 2ed7c8b962c43a7d915fe2821b8258c46d056795..db66431bd43b0b7f9245513f87008b1c193649e4 100644 (file)
--- a/deal.c
+++ b/deal.c
@@ -1,12 +1,13 @@
 /*
  * 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
index d380f1d61ea59c6856c04393d0a89d346a516539..7ae53840e07821d11e1414b5adc4dd245c38d815 100644 (file)
--- a/deal.xml
+++ b/deal.xml
@@ -1,8 +1,8 @@
-.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.
@@ -26,6 +26,8 @@ formula for the binomial coefficient is:
 
     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.
@@ -39,8 +41,19 @@ The program accepts the following options to control its output:
 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.
@@ -81,8 +94,14 @@ To compute your chances of having the 4 aces on the nth draw in
     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.
+