home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!news.tek.com!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v18i010: bingocard - print bingo cards, Part01/01
- Date: 10 Jul 1993 20:55:08 GMT
- Organization: Tektronix, Inc, Redmond, OR, USA
- Lines: 224
- Approved: billr@saab.CNA.TEK.COM
- Message-ID: <21nabc$orp@ying.cna.tek.com>
- NNTP-Posting-Host: saab.cna.tek.com
- Xref: uunet comp.sources.games:1810
-
- Submitted-by: gls@windmill.att.COM
- Posting-number: Volume 18, Issue 10
- Archive-name: bingocard/part01
- Environment: tbl, *roff
-
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 1)."
- # Contents: README MANIFEST bingo.c
- # Wrapped by billr@saab on Sat Jul 10 13:52:50 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(384 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- XThis program prints a specified number of BINGO cards.
- XIts output is input for tbl, to be printed landscape-
- Xstyle, two to a page:
- X
- X +-----------------+
- X | | |
- X | | |
- X | | |
- X | | |
- X | | |
- X +-----------------+
- X
- XThe -f option specifies a font for the numbers.
- XThe -h option specifies a font for the heading.
- X
- END_OF_FILE
- if test 384 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'MANIFEST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MANIFEST'\"
- else
- echo shar: Extracting \"'MANIFEST'\" \(207 characters\)
- sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X MANIFEST 1 This shipping list
- X README 1
- X bingo.c 1
- END_OF_FILE
- if test 207 -ne `wc -c <'MANIFEST'`; then
- echo shar: \"'MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'MANIFEST'
- fi
- if test -f 'bingo.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'bingo.c'\"
- else
- echo shar: Extracting \"'bingo.c'\" \(2816 characters\)
- sed "s/^X//" >'bingo.c' <<'END_OF_FILE'
- X/*
- X * bingo [-f F] [-h F] n
- X *
- X * Col. G. L. Sicherman. December 1992.
- X * You may use and modify this program as you like
- X * so long as you leave this message in it and don't
- X * try to make money from it.
- X */
- X
- X/*
- X * This program prints a specified number of BINGO cards.
- X * Its output is input for tbl, to be printed landscape-
- X * style, two to a page:
- X *
- X * +-----------------+
- X * | | |
- X * | | |
- X * | | |
- X * | | |
- X * | | |
- X * +-----------------+
- X *
- X * The -f option specifies a font for the numbers.
- X * The -h option specifies a font for the heading.
- X */
- X
- X/*
- X * Feel free to change the randomization functions!
- X */
- X
- X#define RAND lrand48
- X#define SRAND srand48
- X
- X#include <ctype.h>
- X#include <stdio.h>
- X
- Xchar *progname;
- Xchar *htypeface = "KB"; /* Cooper Black is nice if you have it */
- Xchar *typeface = "HB"; /* how about Computer Modern Math Italics? */
- X
- Xlong time(), RAND();
- Xvoid SRAND();
- X
- Xstatic void
- Xusage()
- X{
- X fprintf(stderr,
- X "usage: %s [-f typeface] [-h typeface] cardcount\n", progname);
- X exit(1);
- X}
- X
- Xmain(argc,argv)
- Xint argc;
- Xchar **argv;
- X{
- X char *s;
- X int cardc;
- X
- X progname = argv[0];
- X while (--argc) {
- X if ('-'!=**++argv) break;
- X switch(*++*argv) {
- X case 'h':
- X if (!--argc) usage();
- X htypeface = *++argv;
- X break;
- X case 'f':
- X if (!--argc) usage();
- X typeface = *++argv;
- X break;
- X default: usage();
- X }
- X }
- X if (argc != 1) usage();
- X for (s=argv[0]; *s; s++) if (!isdigit(*s)) {
- X fprintf(stderr, "%s: cardcount must be a number\n", progname);
- X exit(1);
- X }
- X cardc = atoi(argv[0]);
- X if (cardc % 2) {
- X fprintf(stderr, "%s: cardcount must be even\n", progname);
- X exit(1);
- X }
- X SRAND(time(0));
- X printf(".\\\" tbl | qroff -L\n.pl 8.5i\n.ll 11i\n.ps 24\n.vs .65i\n");
- X while (cardc) {
- X card("0.0"); cardc--;
- X card("5.4"); cardc--;
- X if (cardc) printf(".bp\n");
- X }
- X exit(0);
- X}
- X
- Xcard(po)
- Xchar *po;
- X{
- X short used[5];
- X int r, i, val;
- X
- X printf(".sp |0.8i\n");
- X printf(".po %si\n", po);
- X printf(".TS\nbox;\n");
- X printf("c1w(48p)f%s ", htypeface);
- X for (i=1; i<5; i++) printf("c0w(1i)f%s ", htypeface);
- X putchar('\n');
- X for (i=0; i<5; i++) printf("%s cf%s ", i? "|": " ", typeface);
- X printf(".\n");
- X for (i=0; i<5; i++) {
- X printf("\\s+8\\s+8\\s+8\\s+8\\&");
- X putchar("BINGO"[i]);
- X printf("\\s-8\\s-8\\s-8\\s-8\\&");
- X putchar(i==4? '\n': '\t');
- X }
- X printf("=\n");
- X for (i=0; i<5; i++) used[i] = 0;
- X for (r=0; r<5; r++) {
- X if (r) printf("_\n");
- X for (i=0; i<5; i++) {
- X if (i) putchar('\t');
- X printf("\\s+8\\s+8\\s+8\\v'9p'");
- X if (r==2 && i==2) freespace();
- X else {
- X do val = RAND()%15;
- X while (used[i] & (1<<val));
- X used[i] |= 1<<val;
- X printf("%d", 1 + i*15 + val);
- X }
- X printf("\\v'-9p'\\s-8\\s-8\\s-8\\&");
- X }
- X putchar('\n');
- X }
- X printf(".TE\n");
- X}
- X
- Xfreespace()
- X{
- X printf("\\f(ZD_\\fP");
- X}
- END_OF_FILE
- if test 2816 -ne `wc -c <'bingo.c'`; then
- echo shar: \"'bingo.c'\" unpacked with wrong size!
- fi
- # end of 'bingo.c'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-