Bingo Card Generator

Author(s): Frank Terranella
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v4 n12 (Volume 4, Issue 12)
Date: December 1983
Pages: 4

One day we needed bingo cards in a hurry. This program arose out of necessity to generate regulation bingo cards.

Non-bingo players may find the quick way it generates random numbers interesting. I set up the numbers I want the computer to select from in variable X$. The computer takes random slices from the string to get the random sequence, assuring non-repeating numbers. I find this method superior to conventional random number choosers that compare each number generated to all those that came before it.

I use the COPY command in the immediate mode to print the bingo card, but you can add 135 COPY for automatic printing.

  10 DIM A$(15,2)
20 PRINT " B I N G O"
30 PRINT AT 9,15;"XX"
40 LET X$="010203040506070809101112131415"
50 GOSUB 150
60 LET X$="161718192021222324252627282930"
70 GOSUB 150
80 LET X$="313233343536373839404142434445"
90 GOSUB 150
100 LET X$="464748495051525354555657585960"
110 GOSUB 150
120 LET X$="616263646566676869707172737475"
130 GOSUB 150
140 STOP
150 FOR X=1 TO 5
160 LET R=(INT (RND*(16-X))+1)*2-1
170 IF LEN X$=2 THEN LET A$(X)=X$
180 IF LEN X$=2 THEN GOTO 210
190 LET A$(X)=X$(R TO R+1)
200 LET X$=X$( TO R-1)+X$(R+2 TO )
210 IF VAL A$(X,1)=0 THEN LET A$(X)=A$(X,2)
220 LET C=(1 AND X$(1)="0")+(8 AND X$(1)="1")+(15 AND X$(1)="3")+(22 AND X$(1)="4")+(29 AND X$(1)="6")
230 IF C=15 AND X=3 THEN GOTO 250
240 PRINT AT 3*X,C;A$(X)
250 NEXT X
260 RETURN
SYNTACTIC SUM: 41970, 8K ROM

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.