PCjs Machines

Home of the original IBM PC emulator for browsers.

Logo

PC-SIG Diskette Library (Disk #1)

[PCjs Machine "ibm5160"]

Waiting for machine "ibm5160" to load....

Information about “GAME SERIES NO 1”

This disk is one of the original game disks for the IBM PC.  Many of
these games seem primitive when compared with more recent programs, but
they may be of interest to those who'd like to see where we've been.
And, as an added bonus, all can be addressed from a single menu.

System Requirements:  Some programs require color graphics.

How to Start:  From BASIC, type LOAD MENU, and press <ENTER>.

File Descriptions:

CASPAR   BAT  File copy utility.
OTHELLO  BAS  Computer based version of OTHELLO game.
CASPAR?  HLP  Help files for CASPAR File copy utility.
ASK      COM  (Y/N)? Question utility.
SAMPLES  BAS  BASIC program.
WOMBATS  WP   WOMBATS text file.
WOMBATS  DOC  Descriptions of how to use WOMBATS.BAS.
PATTERNS BAS  Generates random patterns on color monitor.
KALEID   BAS  Generates random patterns on the color display.
STRINGS  BAS  Generates random patterns on the color display.
MAXIT    BAS  Number game.
HATDANCE BAS  Plays the Mexican Hat Dance song.
COPYOVER DOC  Description of how to use COPYOVER.BAT
DOTS     BAS  Displays dot patterns for display characters.
MENU     BAS  Menu for selecting programs on this disk.
COPYOVER BAT  Copies games from DOS 1.0 or 1.1 disk.
WOMBATS  BAS  Generates word problems.
BLACKJCK BAS  Blackjack game on the monochrome display.
CIRCLES  BAS  Draws random patterns on the color display.
YAHTZEE  BAS  Yahtzee game on the monochrome display.
PONGPONG BAS  Pong type game.

BLACKJCK.BAS

1000 REM  ** CCII BLACKJACK - JAN 3,78 - JESSEN **
1010 REM ADAPTED TO PC BY PATRICK LEABO--TUSCON
1015 REM
1020 SCREEN 0:COLOR 7,0:WIDTH 80:KEY OFF:LOCATE ,,0
1025 SND = 1:KEY 10,"":ON KEY (10) GOSUB 3800 :KEY (10) ON
1030 COMMON MENU:RANDOMIZE VAL(RIGHT$(TIME$,2))
1040 CLS:GOSUB 3440:Z7= RND (1):GOSUB 3250:Y= 1:COLOR 7,0
1050 LOCATE 7,7:PRINT "WELCOME TO...";:PRINT "BLACKJACK!"
1060 K= 0:W1= 0:R= RND (1):N= INT (1945* RND (1)+ 1):X= INT (10* RND (1))
1070 DIM D(52),E(5),V(5),T(5),W(5),T$(34),Q(52)
1080 FOR A= 1 TO 52:D(A)= 0:NEXT
1090 FOR A= 0 TO 39 STEP 13:FOR C= 1 TO 13:Q(A+ C)= C:NEXT C,A
1100 K= K+ 1:FOR P= 1 TO 5:E(P)= 0:V(P)= 0:T(P)= 0:NEXT :V(3)= 1
1110 LOCATE 9,2:GOSUB 3580
1120 LOCATE 23,54:PRINT STRING$(26," ")
1130 LOCATE 21,54:PRINT STRING$(26," ")
1140 LOCATE 9,3:PRINT STRING$(50," ")
1150 LOCATE 21,54:IF W1= 0 THEN GOSUB 3110
1160 IF W1> 0 THEN GOSUB 3090
1170 IF W1< 0 THEN GOSUB 3100
1180 GOSUB 3640:LOCATE 22,55:PRINT"WAGER $                  "
1190 LOCATE 22,62:LINE INPUT W$:P=1
1200 IF W$= "END" OR W$="end" THEN CHAIN "MENU",1000
1210 W= VAL (W$):LOCATE 1,1
1220 IF W< = 500 THEN 1240:REM
1230 LOCATE 23,55:PRINT "HOUSE LIMIT IS $500";:GOSUB 3610:GOTO 1110
1240 IF W> 0 THEN 1260
1250 LOCATE 23,58:PRINT "BE SERIOUS";:GOSUB 3220:GOTO 1110
1260 IF W< 1 THEN 1290
1270 HP= HP+ 1
1280 GOTO 1320
1290 LOCATE 23,58
1300 PRINT "CHEAPSKATE";
1310 GOSUB 3610:GOTO 1110
1320 Q3= W
1330 IF Q3< 250 THEN 1350
1340 Q3= INT (Q3/ 10)
1350 FOR A4= 1 TO Q3:X= RND (1):NEXT :W(2)= W:W(3)= W:GOTO 1380
1360 TE= 0:NT= 0:LOCATE 9,14:PRINT "*I AM RESHUFFLING*":GOSUB 3220:GOTO 1110
1370 LOCATE 9,2:PRINT "HOUSE LIMIT IS $500":GOSUB 3610:GOTO 1110
1380 E(5)= 1:GOSUB 3510:GOSUB 2090:IF E(1)= 0 THEN 1400
1390 V(4)= 1
1400 V(5)= 1:E(5)= 2:GOSUB 3510:GOSUB 2090:M= X:P= 3:V(3)= 1
1410 GOSUB 3510:GOSUB 2090:G= X
1420 GOSUB 3690
1430 V(3)= V(3)+ 1
1440 GOSUB 3510:GOSUB 2090:IF V(2)> 0 THEN 1670
1450 S= X
1460 IF V(3)> 2 THEN 1670
1470 IF T(P)< 21 THEN 1570
1480 IF E(P)< 2 THEN 1500
1490 E(P)= E(P)- 1:T(P)= T(P)- 10:GOTO 1570
1500 LOCATE (Y9+ 2),(X9+ 8):PRINT "*BLACKJACK*"
1510 LOCATE 9,10:PRINT "I DEALT WRONG AGAIN!"
1520 E(5)= 2:P= 1:X9= 8:Y9= 3:X= M:GOSUB 2280
1530 IF V(3)< 5 THEN 1550
1540 W1= W1+ 2* W:GOTO 1560
1550 W1= W1+ 1.5* W
1560 GOTO 3000
1570 IF V(4)= 0 THEN 1670
1580 LOCATE 9,15:PRINT SPC( 22);""
1590 LOCATE 9,15:GOSUB 3640:PRINT "INSURANCE ";:COLOR 31,0:PRINT"?";:COLOR 7,0:GOSUB 3660:PRINT
1600 LOCATE 9,3:PRINT STRING$(50," ")
1610 KS$=LEFT$ (I$,1):IF KS$< > "Y" AND KS$<>"y" THEN 1670
1620 IF T(1)< 21 THEN 1650
1630 W1= W1+ W:PRINT
1640 LOCATE 9,8:PRINT "YOU WIN $";W/ 2;" ON INSURANCE":GOTO 1670
1650 W1= W1- W/ 2:PRINT
1660 LOCATE 9,8:PRINT "YOU LOST $";W/ 2;" ON INSURANCE"
1670 IF T(1)< 21 THEN 1720
1680 IF E(1)< 2 THEN 1700
1690 E(1)= E(1)- 1:T(1)= T(1)- 10:GOTO 1720
1700 LOCATE 9,22:PRINT "**I HAVE BLACKJACK**"
1710 X9= 8:Y9= 3:E(5)= 2:P= 1:X= M:GOSUB 2280:P= 3:GOTO 2910
1720 IF T(P)< = 21 THEN 1780
1730 IF E(P)> 0 THEN 1770
1740 LOCATE 9,16:PRINT "**YOU BUST**"
1750 GOSUB 3560:C1= T(P)- 5* (INT (T(P)/ 5)):IF V(2)= 1 THEN 1990
1760 GOTO 2690
1770 E(P)= E(P)- 1:T(P)= T(P)- 10
1780 IF V(1)= 2 THEN 1750
1790 IF V(3)> 4 THEN 1810
1800 GOTO 1820
1810 IF T(P)< 21 THEN 3230
1820 LOCATE (Y9+ 2),(X9+ 8):GOSUB 3640:COLOR 31,0:PRINT "PLAY ";:COLOR 7,0:GOSUB 3660
1830 V(1)= 0
1840 KS$= LEFT$ (I$,1):IF KS$= "H" OR KS$="h" THEN V(1)= 1:GOTO 1870
1850 IF KS$= "D" OR KS$="d" THEN V(1)= 2:GOTO 1870
1860 IF KS$= "S" OR KS$="s" THEN V(1)= 3:GOTO 1870
1865 IF KS$ <> "0" THEN BEEP :GOTO 1820
1870 LOCATE (Y9+ 2),(X9+ 8):PRINT "      "
1880 IF V(1)< 3 THEN 2030
1890 IF V(2)> 0 THEN 2020
1900 IF V(3)> 2 THEN 2020
1910 IF Q(G)= Q(S)THEN 1940
1920 LOCATE 9,22:PRINT "THAT'S NO PAIR":GOSUB 3610
1930 LOCATE 9,22:PRINT "                        ":GOTO 1820
1940 V(2)= 1:IF Q(G)< 1 THEN 1960
1950 V(1)= 0
1960 T(3)= 0:T(2)= 0:P= 2:X9= 2:Y9= 19:GOSUB 3550
1970 X= S:GOSUB 2280:GOSUB 1980:P= 3:W(3)= W:X= G:GOSUB 1980:GOTO 1440
1980 GOSUB 2230:V(3)= 2:T(P)= C:RETURN
1990 P= 2:V(2)= 2:V(3)= 2:IF Q(G)< 1 THEN 2010
2000 V(1)= 0
2010 GOTO 1440
2020 LOCATE 9,22:PRINT "NO SPLITS NOW     ":GOSUB 3610:LOCATE 9,22:PRINT"               ":GOTO 1820
2030 IF V(1)< 2 THEN 2070
2040 IF V(3)= 2 THEN 2060
2050 LOCATE 9,22:PRINT "TOO LATE TO DOUBLE":GOSUB 3610:LOCATE 9,22:PRINT"                      ":GOTO 1820
2060 W(P)= 2* W(P)
2070 IF V(1)> 0 THEN 1430
2080 GOTO 1750
2090 GOSUB 2120:T(P)= T(P)+ C:IF V(5)= 0 THEN 2110
2100 V(5)= 0:RETURN
2110 GOSUB 2280:RETURN
2120 IF R> = 50 THEN 2170
2130 X= INT (53* RND (Y))
2140 IF X= 0 THEN 2130
2150 IF D(X)= 0 THEN 2210
2160 R= R+ 1:IF R< 50 THEN 2120
2170 FOR A= 1 TO 52:IF D(A)= K THEN 2190
2180 D(A)= 0
2190 NEXT
2200 TE= 0:NT= 0:R= 0:LOCATE 9,18:PRINT "*I RESHUFFLED*":GOSUB 3610:LOCATE 9,18:PRINT"                 ":GOTO 2120
2210 R= 0
2220 D(X)= K
2230 IF Q(X)> 1 THEN 2250
2240 C= 11:E(P)= E(P)+ 1:RETURN
2250 IF Q(X)> 10 THEN 2270
2260 C= Q(X):RETURN
2270 C= 10:RETURN
2280 GOSUB 2290:RETURN
2290 FOR I= 0 TO 34:T$(I)=  " ":NEXT
2300 IF X> 39 THEN U$=CHR$ (5):GOTO 2340
2310 IF X> 26 THEN U$= CHR$ (3):GOTO 2340
2320 IF X> 13 THEN U$= CHR$(4):GOTO 2340
2330 U$= CHR$ (6)
2340 COLOR 0,7
2350 ON Q(X) GOTO 2540,2530,2520,2510,2490,2470,2460,2450,2440,2420,2380,2370
2360 T$(17)= "K":GOTO 2390
2370 T$(17)= "Q":GOTO 2390
2380 T$(17)= "J"
2390 T$(8)= U$:T$(7)= U$:T$(6)= U$:T$(11)= U$:T$(16)= U$
2400 T$(21)= U$:T$(26)= U$:T$(27)= U$:T$(28)= U$:T$(23)= U$
2410 T$(18)= U$:T$(13)= U$:GOTO 2550
2420 T$(6)= U$:T$(8)= U$:T$(16)= U$:T$(18)= U$:T$(26)= U$
2430 T$(28)= U$:GOTO 2510
2440 T$(7)= U$:T$(27)= U$:GOTO 2460
2450 T$(12)= U$:T$(22)= U$:GOTO 2470
2460 T$(17)= U$
2470 T$(6)= U$:T$(8)= U$:T$(16)= U$:T$(18)= U$:T$(26)= U$
2480 T$(28)= U$:GOTO 2550
2490 T$(6)= U$:T$(8)= U$:T$(17)= U$:T$(26)= U$:T$(28)= U$
2500 GOTO 2550
2510 T$(11)= U$:T$(13)= U$:T$(21)= U$:T$(23)= U$:GOTO 2550
2520 T$(7)= U$:T$(17)= U$:T$(27)= U$:GOTO 2550
2530 T$(12)= U$:T$(22)= U$:GOTO 2550
2540 T$(17)= U$
2550 IF Q(X)> 1 AND Q(X)< 11 THEN T$= RIGHT$ (STR$ (Q(X)),1)
2560 IF Q(X)= 11 THEN T$= "J"
2570 IF Q(X)= 12 THEN T$= "Q"
2580 IF Q(X)= 13 THEN T$= "K"
2590 IF Q(X)= 1 THEN T$= "A"
2600 IF X> 13 AND X< 40 THEN T$= T$
2610 IF Q(X)< > 10 GOTO 2640
2620 T$= LEFT$(U$,1):M$= RIGHT$ (STR$ (0),1):N$= RIGHT$ (STR$ (1),1)
2630 T$(0)= N$:T$(1)= M$:T$(33)= T$(0):T$(34)= T$(1):GOTO 2650
2640 T$(0)= T$:T$(34)= T$
2650 Z9= Y9+ 5:X1= X9:Y1= Y9:REM GOSUB 64000:GOSUB 3000
2660 NT= NT+ 1:IF Q(X)> 9 THEN TE= TE+ 1
2670 FOR I= 0 TO 30 STEP 5:LOCATE Z9-I/5,X9+2:FOR J= 0 TO 4:PRINT T$(I+ J);:NEXT J
2680 NEXT I:COLOR 7,0:RETURN
2690 P= 3:X= M:X9= 8:Y9= 3:GOSUB 2290
2700 IF T(3)< 22 THEN 2730
2710 IF V(2)= 0 THEN 2910
2720 GOTO 2910
2730 P= 1
2740 IF T(1)< 17 THEN 3020
2750 IF T(1)> 17 THEN 2770
2760 IF E(1)> 0 THEN 3020
2770 IF T(1)> 21 THEN 3030
2780 P= 3
2790 LOCATE 5,(X9+ 7):PRINT "TOTAL":LOCATE 7,(X9+ 7):PRINT T(1);
2800 IF T(P)> 21 THEN 2840
2810 IF T(1)> 21 THEN 2840
2820 IF T(1)> T(P)THEN 2910
2830 IF T(1)= T(P)THEN 2980
2840 W1= W1+ W(P):PRINT :LOCATE 9,2
2850 FOR J= 1 TO 50:PRINT " ";:NEXT :PRINT :LOCATE 9,12
2860 IF C1> 3 THEN 3120
2870 IF C1> 2 THEN 3130
2880 IF C1> 1 THEN 3140
2890 IF C1> 0 THEN 3150
2900 GOTO 3160
2910 W1= W1- W(P):PRINT :LOCATE 9,2
2920 FOR J= 1 TO 50:PRINT " ";:NEXT :PRINT :LOCATE 9,12
2930 IF C1> 3 THEN 3170
2940 IF C1> 2 THEN 3180
2950 IF C1> 1 THEN 3190
2960 IF C1> 0 THEN 3200
2970 GOTO 3210
2980 LOCATE 9,24:PRINT "WE PUSH"
2990 IF V(2)> 0 THEN 3010
3000 GOSUB 3060:GOSUB 3610:GOTO 1100
3010 P= 3:V(2)= 0:GOTO 2800
3020 E(5)= E(5)+ 1:P= 1:GOSUB 3510:GOSUB 2090:GOTO 2730
3030 IF E(1)= 0 THEN 3050
3040 E(1)= E(1)- 1:T(1)= T(1)- 10:GOTO 2730
3050 LOCATE 6,(X9+ 13):PRINT "*I BUST*":GOTO 2780
3060 LOCATE 9,25:RETURN
3070 IF W1< 0 THEN 3100
3080 IF W1= 0 THEN 3110
3090 PRINT "YOU'RE AHEAD $";W1;:RETURN
3100 PRINT "YOU'RE BEHIND $";- W1;:RETURN
3110 PRINT "YOU'RE EVEN           ";:RETURN
3120 PRINT "I MUST HAVE DEALT WRONG":GOTO 2990
3130 PRINT "YOU'RE LUCKY AGAIN":GOTO 2990
3140 PRINT "YOU MUST HAVE BEEN PEEKING":GOTO 2990
3150 PRINT "I COULD LOSE MY JOB THIS WAY":GOTO 2990
3160 PRINT "THE CARDS HAVE TURNED AGAINST ME":GOTO 2990
3170 PRINT "*THE BOTTOM OF THE DECK STRIKES AGAIN*":GOTO 2990
3180 PRINT "A VICTORY FOR US GOOD GUYS":GOTO 2990
3190 PRINT "YOU CAN'T BEAT SKILL":GOTO 2990
3200 PRINT "YOU CAN'T WIN THEM ALL":GOTO 2990
3210 PRINT "THANKS!":GOTO 2990
3220 FOR M9= 1 TO 52:D(M9)= 0:NEXT :R= 0:RETURN
3230 LOCATE 9,12:PRINT "*YOU WIN WITH 5 CARDS*":PRINT :GOTO 1520
3240 REM DRAW INSTRUCTIONS
3250 COLOR 0,7
3260 FOR N=2 TO 18:LOCATE N,54:PRINT STRING$(26," "):NEXT
3270 LOCATE 2,58:PRINT "IBM PC BLACKJACK";
3280 LOCATE 3,60:PRINT"************"
3290 LOCATE  4,55:PRINT"FOLLOW ALL BETS WITH"
3300 LOCATE 5,60:PRINT"RETURN KEY"
3310 LOCATE 7,55:PRINT"RESPONSES:"
3320 LOCATE 8,57:PRINT"<CR> = STAND":LOCATE 9,60:PRINT"H = HIT"
3330 LOCATE 10,60:PRINT"D = DOUBLE DOWN":LOCATE 11,60:PRINT"S = SPLIT PAIR"
3340 LOCATE 12,58:PRINT"INSURANCE:"
3350 LOCATE 13,60:PRINT"N = NO":LOCATE 14,60:PRINT"Y = YES"
3360 LOCATE 15,63:PRINT"RULES:"
3370 LOCATE 16,54:PRINT"HOUSE LIMIT IS $500.00"
3380 LOCATE 17,54:PRINT"BLACKJACK PAYS 1.5 TO 1"
3390 LOCATE 18,54:PRINT;"BET END TO QUIT";:COLOR 7,0
3400 ME$="HOUSE":FOR YP=1 TO YP+LEN(ME$):LOCATE YP+1,2:PRINT MID$(ME$,YP,1):NEXT
3410 ME$="PLAYER":FOR YP=1 TO YP+LEN(ME$):LOCATE YP+9,2:PRINT MID$(ME$,YP,1):NEXT
3420 RETURN
3430 REM DRAW FIELD
3440 LOCATE 1,1:PRINT"╒";STRING$(51,"═");"╤";STRING$(26,"═");"╕";
3450 LOCATE 2,1:FOR N=1 TO 22:PRINT"│"TAB(53);"│";TAB(80);"│";:NEXT
3460 LOCATE 24,1:PRINT"│";:LOCATE 24,53:PRINT"│";
3470 LOCATE 25,1:PRINT"╘";STRING$(51,"═");"╧";STRING$(26,"═");
3480 DEF SEG=&HB000:POKE 3998,190:POKE 3838,179:DEF SEG
3490 LOCATE 19,53:PRINT"╞══════════════════════════╡"
3500 LOCATE 1,1:RETURN
3510 ON P GOTO 3520,3530,3540
3520 X9= INT (2+ E(5)* 6- 6):Y9= 3:GOTO 3550
3530 X9= INT (2+ V(3)* 6- 6):Y9= 19:GOTO 3550
3540 X9= INT (2+ V(3)* 6- 6):Y9= 11
3550 RETURN
3560 LOCATE (Y9+ 0),(X9+ 7):PRINT "TOTAL";
3570 LOCATE (Y9+ 3),(X9+ 7):PRINT T(P);:RETURN
3580 FOR N=1 TO 7:LOCATE N+1,3:PRINT STRING$(50," "):NEXT
3590 FOR N=0 TO 15:LOCATE N+9,3:PRINT STRING$(50," ");:NEXT
3600 RETURN
3610 FOR P1= 1 TO 1000:NEXT P1:RETURN
3620 REM   PLINK
3630 IF SND = 1 THEN PLAY "L64T200N46":REM PLINK
3635 RETURN
3640 REM   PLONK
3650 IF SND = 1 THEN PLAY "L64T200N70":REM PLONK
3655 RETURN
3660 REM   KEYSTROKE
3670 I$=INKEY$:IF I$=""THEN 3670 ELSE IF I$= CHR$(13) THEN I$= "0":RETURN
3680 RETURN
3690 REM   BACK OF CARD
3700 COLOR 0,7:CB$= "╬╬╬╬╬"
3710 GOSUB 3620
3720 X1= 10:Y1= 1:FOR NN= 7 TO 1 STEP - 1
3730 LOCATE Y1+NN,X1:PRINT CB$:NEXT :COLOR 7,0:RETURN
3800 REM   toggle sound on or off with F10
3810 IF SND = 1 THEN SND = 0 ELSE SND=1
3820 RETURN

CIRCLES.BAS

1000 '
1010 ' CIRCLE DRAWER -- Patrick Leabo
1020 '
1025 POKE 106,0
1030 DIM XP(20),YP(20)
1035 SCREEN 1
1036 GOSUB 2000
1040 FOR N=3 TO 19
1042 C=C+1:IF C>3 THEN C=1
1045 IF N>7 THEN N=N+3
1050 RR=95:X=160:Y=100
1060 GOSUB 1110
1070 CH$=INKEY$:IF CH$= CHR$(27) THEN SCREEN 0:CHAIN "MENU",1000
1080 FOR DL=1 TO 2000:NEXT DL:CLS
1090 NEXT:GOTO 1036
1100 '
1110 '     circle drawer subroutine
1120 '     INPUTS N,RR,X,Y
1130 '
1140 PI=3.14159:AN=PI/2:TP=2*PI:M=0:DE=TP/N
1145 LOCATE 1,1:PRINT"String Art":PRINT"esc=quit"
1150 FOR M=1 TO N
1160 DX=1.5*INT(RR*COS(AN)+0.5):DY=-INT(RR*SIN (AN)+0.1)
1170 XP(M)=X+DX:YP(M)=Y+DY
1180 PSET(XP(M),YP(M))
1190 AN=AN+DE:NEXT M
1200 FOR NN=1 TO N:FOR MM=NN TO N
1210 LINE (XP(NN),YP(NN))-(XP(MM),YP(MM)),C
1220 NEXT MM,NN:RETURN
2000 REM STRING ART
2005 CLS
2010 X0=X0 + 1.06:Y1=Y1+1.9799999#
2020 Y0=Y0-2:X1=X1-1.43
2030 IF Y0<3 THEN Y0=Y0+180
2040 IF X1<3 THEN X1 = X1 + 300
2050 IF X0>300 THEN X0=X0-300
2060 IF Y1>180 THEN Y1=Y1-180
2070 C=INT(RND*3+1)
2080 LINE (X0,Y0)-(X1,Y1),C:K=K+1
2090 IF K<185 THEN 2010
2100 K=0:FOR N=1 TO 2000:NEXT:CLS:RETURN

COPYOVER.DOC

Several of the games called from the menu program are included on the
IBM DOS disk and must be copied onto this disk for all menu selections
to work.  The batch file COPYOVER.BAT is provided for this purpose.
To use, place DOS disk(1.0 OR 1.1) in drive a: and this game disk in drive b:
If you have a single drive system wait for prompts from the computer.
Now type:

B:COPYOVER

When all files have been copied your disk is ready to use.


DOTS.BAS

1000 REM Program to display dot matrix characters from ROM patterns
1010 REM Will Fastie -- 19 Nov 81     Creative Computing  March 1982
1020 REM Entered by Patrick Leabo    Tuscon
1030 DEFINT A-Z
1040 DOTCHAR = 219
1050 DOTSIZE = 1
1060 DOT$=STRING$(DOTSIZE,DOTCHAR)
1070 GOSUB 1410
1080 DEF SEG=&HF000
1090 BASEADR=&HFA6E
1100 BYTESPERCHAR=8
1110 KEY OFF
1120 CLS:PRINT"This program prints out the dot pattern stored in BIOS for graphic characters.     PRESS RETURN TO CONTINUE! ":INPUT A$
1130 CLS
1140 PRINT"PRESS THE ONE YOU WANT TO SEE";
1150 PRINT"---space bar to quit";
1160 CHAR$=INKEY$: IF CHAR$="" THEN 1160
1170 IF CHAR$=" " THEN CHAIN "MENU",1000
1180 CODE =ASC(CHAR$)
1190 IF CODE >= 128 THEN BEEP:GOTO 1130
1200 ADR = BASEADR + (CODE*BYTESPERCHAR)
1210 CLS
1220 LOCATE  6,19:PRINT CHAR$
1230 GOSUB 1440
1240 X=8
1250 Y=(SCREENWIDTH-(8*DOTSIZE))/2
1260 GOSUB 1280
1270 GOTO 1140
1280 FOR ROW=1 TO 8
1290   ROWVAL=PEEK(ADR+(ROW-1))
1300   FOR COL=1 TO 8
1310     COLMASK=2^(7-(COL-1))
1320     IF (ROWVAL AND COLMASK) <> 0 THEN GOSUB 1370
1330   NEXT COL
1340 NEXT ROW
1350 LOCATE 1,1
1360 RETURN
1370 REM Locate to bit position and display giant pixel!
1380 LOCATE X+(ROW-1),Y+(COL-1)*DOTSIZE
1390 PRINT LEFT$(DOT$,DOTSIZE);
1400 RETURN
1410 REM Initialize display
1420 SCREEN 0:WIDTH 40:SCREENWIDTH=40
1430 RETURN
1440 REM BOX PRINTER
1450 X=15:Y= 7:W=8
1460 LOCATE Y,X
1470 PRINT CHR$(201)+STRING$(W,CHR$(205))+CHR$(187)
1480 FOR N = 1 TO 8
1490 LOCATE Y+N,X :PRINT CHR$(186)+STRING$(W,CHR$(32))+CHR$(186)
1500 NEXT N
1510 LOCATE Y+N,X :PRINT CHR$(200)+STRING$(W,CHR$(205))+CHR$(188)
1520 RETURN

FILES001.TXT

Disk No 1
Program Title: GAMES #1
PC-SIG version 1

This disk is one of the original game disks for the IBM PC.  Many of
these games are primitive compared to ones on latter disks, but they
may all be addressed from a single menu.

Usage: Entertainment

System Requirements: IBM PC or close compatible with Color graphics
                     adapter, 1 disk drive, printer, and Dos 1.0 or later

How to Start: Run program "menu" to start.

File Descriptions:

PATTERNS BAS+ Generates random patterns on color monitor
BLACKJCK BAS  Blackjack game on the monochrome display
YAHTZEE  BAS  Yahtzee game on the monochrome display
MENU     BAS  Menu for selecting programs on this disk
DOTS     BAS  Displays dot patterns for display characters
HATDANCE BAS  Plays the mexican hat dance song
KALEID   BAS+ Generates random patterns on the color display
MAXIT    BAS+ Number game
STRINGS  BAS+ Generates random patterns on the color display
WOMBAT   BAS  Generates word problems
CIRCLES  BAS+ Draws random patterns on the color display
PONGPONG BAS  Pong type game
COPYOVER BAT  Copies games from DOS 1.0 or 1.1 disk
COPYOVER DOC  Description of how to use COPYOVER.BAT

PC-SIG
1030D E Duane Avenue
Sunnyvale Ca. 94086
(408) 730-9291
(c) Copyright 1987 PC-SIG

HATDANCE.BAS

1000 ' **** MEXICAN HAT DANCE ****
1010 '
1020 ' ADAPTED TO IBMPC FROM TRS80 COLOR COMPUTER BY PATRICK LEABO
1030 '
1040 SCREEN 0:WIDTH 40:COLOR 2,0:LOCATE ,,0
1050 PRINT CHR$(12):POKE 106,0
1060 PRINT STRING$(40,"*")
1070 PRINT:PRINT
1080 PRINT"          MEXICAN HAT DANCE":PRINT
1085 PRINT"              esc to exit"
1090 PRINT:PRINT STRING$(40,"*")
1100 FOR X = 1 TO 500:NEXT
1110 ' S T A R T   TUNE
1120 O$ = "MFT128O2"
1130 P$ = "L16CFP16CFP16CFP8P16"
1140 Q$ = "CFGFEP16FGP8P16"
1150 X$ = "XO$;XP$;XQ$;"
1160 PLAY X$:GOSUB 2000
1170 R$ = "CEP16CEP16CEP8P16"
1180 S$ = "CEFEDP16EFP8P16"
1190 Y$ = "XO$;XR$;XS$;"
1200 PLAY Y$
1210 ' 2ND TIME
1220 O$ = "O1"
1230 PLAY X$
1240 O$ = "O4"
1250 S$ = "CEFEDP16EFO4CO3AF"
1260 PLAY Y$:GOSUB 2000
1270 A$ = "O3CO2BO3CO2AA-AFEFCP8"
1280 B$ = "CO1BO2CDEFGAB-O3CEG"
1290 O$ = "T160"
1300 Z$ = "XO$;XA$;XB$;"
1310 PLAY Z$:GOSUB 2000
1320 C$ = "O3B-AB-GF+GED+ECEG"
1330 D$ = "O4L32CP32CP32CP32L16DCO3B-AGFP8"
1340 E$ = "XO$;XC$;XD$;"
1350 PLAY E$:GOSUB 2000
1360 F$ = "O2L32GP32GP32GP32DP32DP32DP32EP32FP32L32EL32GP32O1GP32L16G"
1370 G$ = "O2L32GP32GP32GP32DP32DP32DP32EP32FP32L16ECO1GC"
1380 H$ = "XF$;XG$;"
1390 PLAY H$:GOSUB 2000
1400 I$ = "XF$;"
1410 PLAY I$
1420 J$ = "O2L32GP32GP32GP32AP32GP32GP32AP32BP32O3L8CP16"
1430 PLAY "XJ$;":GOSUB 2000
1440 K$ = "O4L2DL8DEDEL16DEDEL32DEDEDEDEL64DEDEDEDEDEDEDEDEL64DEDEDEDEDEDEDEDEDEDEDEDEL64DD-CO3BB-AA-GF+FEE-DD-L8DD-"
1450 PLAY "XK$;":GOSUB 2000
1460 M$ = "T200L16DO2BB-BGF+GL8DP16"
1470 N$ = "L16DC+DEF+GABO3CO2L8AP16"
1480 AA$ = "O3L16CO2BO3CO2AG+AF+FF+L8DP16"
1490 BB$ = "O3L16DDDEDCO2BAO3DEDCO2BA"
1500 CC$ = "O2DEDCO1BAO4DEDDEDDEDDEF+GDO3BGT160DO2BGT128DO1T100BL16P8L8G"
1510 PLAY "XM$;XN$;XAA$;XBB$;XCC$;"
1520 PRINT:PRINT:PRINT:PRINT:PRINT"     NOW THAT'S A HOT TAMALE"
1530 GOSUB 2000:FOR X=1 TO 2000:NEXT:GOTO 1000
2000 IF INKEY$=CHR$(27) THEN CHAIN "MENU",1000 ELSE RETURN

KALEID.BAS

135 DEFINT A-Z
1000 REM  KALEIDOSCOPE
1010 REM PATRICK LEABO--TUSCON
1020 REM 3-14-82
1030 KEY OFF:POKE 106,0
1040 DIM MT(25)
1045 RANDOMIZE VAL(RIGHT$(TIME$,2))
1050 CH$(1)="░":CH$(2)="▒":CH$(3)="▓":CH$(4)="█"
1060 SCREEN 0,1:WIDTH 80:WIDE = 80
1065 DEF SEG = 0:IF (PEEK(&H410) AND &H30) <> &H30 THEN WIDTH 40:WIDE = 40
1066 DEF SEG
1070 REM START
1075 LOCATE ,,0
1080 A= 31:B= 15:X1= 16:Y1= 8
1090 A= INT (RND (1)* 20+ 19):B= INT (RND (1)* 10+ 13)
1100 RESTORE 1120
1110 FOR N= 0 TO 7:READ DX(N):READ DY(N):NEXT
1120 DATA 1,0,1,1,0,1,-1,1,-1,0,-1,-1,0,-1,1,-1
1130 FOR N= 0 TO 7:READ NT(N)
1140 NEXT
1150 DATA 1,3,5,6,8,10,12,13
1160 FOR N= 0 TO 24:MT(N)=N+1:NEXT
1170 FOR CC= 0 TO 12:GOSUB 1720:NEXT:CLS
1180 FOR NN= 1 TO 50
1189 REM DRAW LOOP
1190 DI= INT (8* RND (1))
1200 IF RND (1) < 0.25 THEN CH$=CH$(4* RND (1)+1):GOSUB 1600
1205 IF RND(1) < 0.25 THEN CC=CC+1:IF CC>7 THEN CC=0 ELSE COLOR CC,0
1210 GOSUB 1590
1220 FOR N= 1 TO INT (RND (1)* 8)
1230 X1= X1+ DX(DI):Y1= Y1+ DY(DI)
1240 IF X1< 1 THEN X1= A:GOTO 1260
1250 IF X1> A THEN X1= 1
1260 IF Y1< 1 THEN Y1= B:GOTO 1280
1270 IF Y1> B THEN Y1= 1
1280 X2= 40- X1:Y2= 24- Y1
1290 LOCATE Y1,X1:PRINT CH$;:IF WIDE = 80 THEN LOCATE Y1,X1+40:PRINT CH$
1300 LOCATE Y1,X2:PRINT CH$;:IF WIDE = 80 THEN LOCATE Y1,X2+40:PRINT CH$
1310 LOCATE Y2,X1:PRINT CH$;:IF WIDE = 80 THEN LOCATE Y2,X1+40:PRINT CH$
1320 LOCATE Y2,X2:PRINT CH$;:IF WIDE = 80 THEN LOCATE Y2,X2+40:PRINT CH$
1330 PRINT CHR$(11):PRINT
1340 NEXT :NEXT
1350 GOTO 1070
1360 REM  VECTORS
1370 FOR CC= 0 TO 12:GOSUB 1720:NEXT
1380 CC= INT (63* RND (1))
1390 IF RND (1)= 0.5 THEN CC= 1
1400 IF RND (1)> 0.5 THEN CC= CCAND 15
1410 MA= CCAND 56
1420 PLOT 6,CC,12:CC= CCAND 15
1430 IF CC> 12 THEN CC= 12
1440 GOSUB 1790
1450 A= INT (RND (1)* 50+ 60):B= INT (RND (1)* 50+ 60):GOSUB 1580
1460 FOR N= 1 TO 50
1470 X1= X3:X2= X4:Y1= Y3:Y2= Y4:GOSUB 1580
1480 DI= INT ((X3/ A)* 8):GOSUB 1790
1490 PLOT 2,253,X1,Y1,242,X3,Y3,255
1500 PLOT 2,253,X1,Y2,242,X3,Y4,255
1510 PLOT 2,253,X2,Y1,242,X4,Y3,255
1520 PLOT 2,253,X2,Y2,242,X4,Y4,255
1530 IF RND (1)< 0.25 THEN CC= INT (8* RND (1)):GOSUB 1720:PLOT 6,CCOR MA
1540 IF RND (1)< 0.1 THEN PLOT 31
1550 NEXT
1560 FOR CC= 0 TO 12:GOSUB 1720:NEXT
1570 CC= INT (63* RND (1)):GOTO 1070
1580 X3= INT (A* RND (1)):Y3= INT (B* RND (1)):X4= 127- X3:Y4= 127- Y3:RETURN
1590 PLAY "MFL16N"+STR$(NT(DI)+39):RETURN
1600 OK= OK+ 1:IF OK> 2 THEN OK= 0
1610 ON OK GOTO 1660,1690
1620 NS= 4:GOSUB 1710
1630 NS= 0:GOSUB 1710:NS= 2:GOSUB 1710
1640 NS= 4:GOSUB 1710:NS= 7:GOSUB 1710
1650 RETURN
1660 NS= 1:GOSUB 1710:NS= 3:GOSUB 1710
1670 NS= 4:GOSUB 1710:NS= 6:GOSUB 1710
1680 RETURN
1690 NS= 0:GOSUB 1710:NS= 3:GOSUB 1710
1700 NS= 5:GOSUB 1710:NS= 7:GOSUB 1710:RETURN
1710 PLAY "L24N"+STR$(NT(NS)+39):IF INKEY$ = CHR$(27) THEN CHAIN "MENU",1000 ELSE RETURN
1720 REM  SOUNDS
1730 NS= 0+ CC:GOSUB 1780
1740 NS= 4+ CC:GOSUB 1780
1750 NS= 7+ CC:GOSUB 1780
1760 NS= 12+ CC:GOSUB 1780
1770 RETURN
1780 PLAY "L24N"+STR$(MT(NS)+26):RETURN
1790 ON DI+ 1 GOTO 1800,1800,1820,1820,1840,1840,1870,1870
1800 NS= 0+ CC:GOSUB 1780:RETURN
1810 NS= 2+ CC:GOSUB 1780:RETURN
1820 NS= 4+ CC:GOSUB 1780:RETURN
1830 NS= 5+ CC:GOSUB 1780:RETURN
1840 NS= 7+ CC:GOSUB 1780:RETURN
1850 NS= 9+ CC:GOSUB 1780:RETURN
1860 NS= 11+ CC:GOSUB 1780:RETURN
1870 NS= 12+ CC:GOSUB 1780:RETURN

MAXIT.BAS

1000 '   MAXIT  FROM PET
1010 '   ADAPTED TO IPM PC BY PATRICK LEABO
1020 '   3-20-82              TUCSON ARIZONA
1030 '
1090 SCREEN 0:COLOR 7,0:WIDTH 40:KEY OFF
1100 DEFINT A-Z:DATA 49,51,53,54,56,58,60,61
1110 RANDOMIZE VAL(RIGHT$(TIME$,2))
1120 FOR N= 0 TO 7:READ NT(N):NEXT
1140 DIM BD(7,7),AV(64)
1150 CLS:LOCATE 3,11:PRINT "THE GAME OF MAXIT"
1160 PRINT "DO YOU WANT INSTRUCTIONS ? ";:GOSUB 3000:PRINT
1170 IF KS$= "Y" OR KS$="y" THEN GOSUB 2210
1180 PRINT :PRINT "1 OR 2 PLAYERS ?";:GOSUB 3000
1190 PRINT KS$:NP= VAL (KS$):PRINT
1200 IF NP= 1 THEN 1240
1210 IF NP< > 2 THEN 1180
1220 INPUT "WHAT IS YOUR NAME #1";P1$:P1$=LEFT$(P1$,7):BEEP:PRINT
1230 PRINT :INPUT "WHAT IS YOUR NAME #2";P2$:P2$=LEFT$(P2$,7):BEEP:PRINT :GOTO 1250
1240 P2$= "IBM PC":INPUT "WHAT IS YOUR NAME ";P1$:BEEP:PRINT:P1$=LEFT$(P1$,7)
1250 CLS:LOCATE 2,16:PRINT "M A X I T":GOSUB 2360
1260 RANDOMIZE VAL(RIGHT$(TIME$,2)):MD= 1
1270 FOR K= 1 TO 64:AV(K)= K:NEXT
1280 FOR K= 64 TO 1 STEP - 1:READ PC
1290 P1= 1+ INT (K* RND (1))
1300 J= AV(P1)- 1
1310 IF P1< K THEN FOR I= P1 TO K- 1:AV(I)= AV(I+ 1):NEXT
1320 I= INT (J/ 8):J= J- 8* I
1330 BD(I,J)= PC:GOSUB 1540:NT= J:GOSUB 1980
1340 NEXT K:RESTORE 1350:NT= 7:GOSUB 1980:GOSUB 1980:GOSUB 1980
1350 DATA 15,10,9,9,8,8,7,7,7,6,6,6
1360 DATA 5,5,5,5,4,4,4,4,3,3,3,3,3
1370 DATA 2,2,2,2,2,2,1,1,1,1,1
1380 DATA 0,0,0,0,0,0,-1,-1,-1,-1,-1
1390 DATA -2,-2,-2,-2,-3,-3,-3
1400 DATA -4,-4,-4,-5,-5,-6,-6
1410 DATA -7,-9,100
1420 S1= 0:S2= 0:GOSUB 2000
1430 REM  PLAYER 1
1440 PL= 1:GOSUB 1630:IF FL= 0 THEN 1470
1450 REM  PLAYER 2
1460 PL= 2:GOSUB 1630:IF FL< > 0 THEN 1430
1470 LOCATE 22,1:PRINT STRING$(39," ");:LOCATE 22,1:ON 2+ SGN (S2- S1)GOSUB 1510,1520,1530
1480 POKE 106,0:LOCATE 23,1:PRINT STRING$(39," ");:LOCATE 23,1:PRINT "DO YOU WANT TO PLAY AGAIN ?";:C$="":WHILE C$="":C$=INKEY$:WEND:PRINT C$
1490 IF "Y"= C$ OR "y"=C$ THEN 1250
1500 CHAIN "MENU",1000
1505 END
1510 PRINT P1$;" WON BY ";STR$ (S1- S2);" POINTS":PRINT :RETURN
1520 PRINT "IT'S A TIE !!                   ":RETURN
1530 PRINT P2$;" WON BY ";STR$ (S2- S1);" POINTS ":PRINT :RETURN
1540 REM  DRAW BOARD POSITION I,J IN MODE MD (1=RED,2=BLACK)
1550 PC= BD(I,J)
1560 LOCATE I* 2+ 5,J*4+5
1570 IF MD= 2 THEN COLOR 0,7:GOTO 1590
1580 COLOR 7,0
1590 IF PC= 100 THEN PRINT "**":C1= I:C2= J:GOTO 1620
1600 IF PC= - 100 THEN PRINT "  ":GOTO 1620
1610 PRINT RIGHT$ ("  "+ STR$ (PC),2)
1620 COLOR 7,0:RETURN
1630 IF PL= 2 THEN 1670
1640 FL= 600:FOR J= 0 TO 7:FL= FL+ BD(C1,J):NEXT
1650 IF FL= 0 THEN RETURN
1660 NM$= P1$:DX= 1:DY= 0:GOSUB 1700:RETURN
1670 FL= 600:FOR I= 0 TO 7:FL= FL+ BD(I,C2):NEXT
1680 IF FL= 0 THEN RETURN
1690 NM$= P2$:DX= 0:DY= 1:GOSUB 1700:RETURN
1700 Y= C1:X= C2:FX= 1
1705 IF PL = 2 THEN COLOR 0,7
1710 IF NP= 2 OR PL= 1 THEN 1730
1720 PRINT :GOSUB 1970:PRINT NM$;"'S TURN.         ":GOSUB 2060:GOTO 1880
1730 GOSUB 1970:ON FX GOTO 1740,1750
1740 PRINT :GOSUB 1970:PRINT NM$;", YOUR TURN.     ":PRINT :GOTO 1760
1750 PRINT "                    ":PRINT
1760 PLAY "L64T200N70"
1770 C$=INKEY$:IF C$="" THEN 1770 ELSE KS=ASC(C$)
1775 IF C$=CHR$(27) THEN 1500
1780 IF C$< > " "THEN 1860
1790 OX= X:OY= Y
1800 Y= Y+ DY:IF Y> 7 THEN Y= 0
1810 X= X+ DX:IF X> 7 THEN X= 0
1820 PT= BD(Y,X):IF ABS (PT)= 100 THEN 1800
1830 MD= 1:I= OY:J= OX:GOSUB 1540
1840 MD= 2:I= Y:J= X:GOSUB 1540
1850 GOTO 1770
1860 IF C$< > CHR$ (13)THEN 1770
1870 IF ABS (BD(Y,X))= 100 THEN 1770
1880 REM SCORE IT
1890 '
1900 IF NP=1 AND PL =2 THEN MD= 2:I= Y :J= X:GOSUB 1540:FOR DL = 1 TO 1500:NEXT
1905 GOSUB 1990:MD= 1:I= C1:J= C2:BD(I,J)= - 100:GOSUB 1540
1910 I= Y:J= X:PT= BD(I,J):BD(I,J)= 100:GOSUB 1540
1920 IF PL= 1 THEN S1= S1+ PT
1930 IF PL= 2 THEN S2= S2+ PT
1940 GOSUB 1970
1950 LOCATE 22,25:PRINT "LAST TAKEN:";PT;" ";
1960 GOSUB 2000:RETURN
1970 LOCATE 22,1:RETURN
1980 PLAY "MNMFL64N=NT(NT);":RETURN
1990 FOR N=49 TO 70 :PLAY "MBT255MLO3L64N=N;":NEXT:RETURN
2000 GOSUB 1970
2010 LOCATE 21,1:ME$=P1$+"'S SCORE="+STR$ (S1)+"  "+P2$+"'S SCORE="+STR$ (S2)+"       ":ME$=LEFT$(ME$,40):PRINT ME$:RETURN
2020 REM  SCREEN INSTRUCTIONS
2050 RETURN
2059 '      COMPUTER PLAYER ALGORITHM
2060 MT= - 100:GG= - 1:FOR A1= 0 TO 7:PC= BD(A1,C2):IF ABS (PC)= 100 THEN 2200
2070 MX= - 100:FOR A2= 0 TO 7
2080 IF A2< > C2 THEN PK= BD(A1,A2):IF PK< > - 100 AND PK> MX THEN MX= PK:SV= A
2090 NEXT A2
2100 IF MX< > - 100 THEN 2120
2110 IF PC> MT THEN MT= PC:GG= A1:GOTO 2200
2120 IF GG< 0 THEN GG= A1
2130 FOR A2= 0 TO 7:PQ= BD(A2,SV):IF PQ= - 100 OR A2= A1 THEN 2190
2140 MY= - 100:FOR A3= 0 TO 7:PW= BD(A2,A3):IF A3= SV THEN 2160
2150 IF ABS (PW)< > 100 AND PW> MY THEN MY= PW
2160 NEXT A3
2170 IF MY= - 100 THEN MY= 0
2180 DT= PC- MX+ PQ- MY:IF DT> MT THEN MT= DT:GG= A1
2190 NEXT A2
2200 NEXT A1:Y= GG:RETURN
2210 LOCATE 1,16:PRINT "M A X I T":PRINT
2220 PRINT "THE OBJECT OF MAXIT IS TO GET AS MANY"
2230 PRINT "POINTS AS POSSIBLE. TWO PLAYERS CAN"
2240 PRINT "PLAY AGAINST EACH OTHER, OR ONE AGAINST"
2250 PRINT "THE COMPUTER.":PRINT :PRINT
2260 PRINT "YOU GET POINTS BY MOVING A MARKER "
2270 PRINT "            **"
2280 PRINT "TO A SPACE WITH A NUMBER IN IT. THE"
2290 PRINT "FIRST PLAYER ALWAYS MOVES HORIZONTALLY"
2300 PRINT "AND THE SECOND MOVES VERTICALLY.  YOU"
2310 PRINT "INDICATE THE PLACE YOU WANT TO MOVE TO"
2320 PRINT "BY USING THE SPACE BAR TO POSITION"
2330 PRINT "YOURSELF, AND THEN PUSH RETURN TO TAKE"
2340 PRINT "THAT PIECE.":RETURN
2350 PLOT 8:END
2360 REM  OTHER OTHELLO BOARD
2370 '
2380 TOP$="╒═══╤═══╤═══╤═══╤═══╤═══╤═══╤═══╕"
2382 MD1$="│   │   │   │   │   │   │   │   │"
2384 MD2$="╞═══╪═══╪═══╪═══╪═══╪═══╪═══╪═══╡"
2386 BOT$="╘═══╧═══╧═══╧═══╧═══╧═══╧═══╧═══╛"
2390 LOCATE 4,4:PRINT TOP$
2400 FOR Y=5 TO 17 STEP 2:LOCATE Y,4:PRINT MD1$:LOCATE Y+1,4:PRINT MD2$:NEXT
2410 LOCATE 19,4:PRINT MD1$:LOCATE 20,4:PRINT BOT$
2440 GOSUB 2020
2450 RETURN
3000 KS$="":WHILE KS$="":KS$=INKEY$:WEND:KS=ASC(KS$):RETURN
1000 ' Start of menu program
1001 REM PATRICK LEABO--TUSCON
1002 REM 3-14-82
1003 DEFINT A-Z:COMMON MENU
1004 KEY OFF:DIM TI$(20),FINAME$(20),GRA(20):TI$(1)="Switch Displays":GRA(1)=1:TI$(2)="Next Menu":GRA(2)=0:TI$(14)="Quit":GRA(14)=0
1005 DEF SEG:SCREEN 0,1:NOMENU = 2:POKE 106,0
1006 COLOR 7,0:IF MENU=0 THEN MENU=1
1010 CLS:DEF SEG=0:IF (PEEK(&H410) AND &H30) = &H30 THEN DSPMODE = 1 ELSE DSPMODE = 2
1015 DEF SEG = &H40:POKE &H17,64:DEF SEG
1020 DEF SEG :POKE 106,0:IF DSPMODE = 1 THEN WIDTH 80 ELSE WIDTH 40
1022 COLOR 7,0:LOCATE ,,0
1025 ON MENU GOSUB 2000,3000
1030 LOCATE 1,1:PRINT"╔";STRING$(37,"═");"╗";
1040 FOR N = 2 TO 22:LOCATE N,39:PRINT"║";:NEXT N
1045 FOR N = 2 TO 22:LOCATE N,1:PRINT"║";:NEXT N
1050 LOCATE 23,1:PRINT"╚";STRING$(37,"═");"╝";
1060 LOCATE 2,5:PRINT"Patrick Leabo's fun DISK #1"
1070 LOCATE 3,10:PRINT TI$(0)
1075 L = 5:IF DSPMODE = 1 THEN GOSUB 9000
1080 FOR N=1 TO 14:
1090 LOCATE N +4,L:IF GRA(N)=0 THEN PRINT"  "; ELSE IF GRA(N)=1 THEN PRINT"* "; ELSE PRINT "Φ ";
1095 PRINT CHR$(N+64);". ";TI$(N)
1100 NEXT
1105 LOCATE 22,4:PRINT"* color required   Φ 80 character";
1110 LOCATE 20,26:PRINT"          ":LOCATE 20,6:PRINT "Press Your Choice  ";:COLOR 26,0:PRINT"?";:COLOR 7,0:WHILE INKEY$<>"":WEND
1115 CH$=INKEY$:IF CH$="" THEN 1115 ELSE PRINT CH$:CH=ASC(CH$):IF CH >78 THEN CH= CH-32
1120 IF CH<64 OR CH>78 THEN LOCATE 22,4:PRINT"SORRY-INVALID CHOICE !!!!!!       ":BEEP:FOR N=1 TO 2000:NEXT:GOTO 1105
1125 IF CH<>65 AND GRA(CH-64)=1 AND DSPMODE=1 THEN LOCATE 22,4:PRINT"WHOOPS-WRONG DISPLAY !!!!!!!       ":BEEP:FOR N=1 TO 2000:NEXT:GOTO 1105
1130 ON CH-64  GOTO 1140,1150
1132 IF CH=78 THEN LOCATE 22,4:PRINT"Bye. See you later !!!!!!!!       ";:BEEP:END
1133 IF FINAME$(CH-64)="" THEN LOCATE 22,4:PRINT"NO PROGRAM YET !!!!!!!!!!!!!       ":BEEP:FOR N=1 TO 2000:NEXT:GOTO 1105
1139 CHAIN FINAME$(CH-64),1000
1140 GOSUB 60000:CLS:GOTO 1010
1150 MENU = MENU + 1:IF MENU > NOMENU THEN MENU = 1
1160 GOTO 1010
2000 ' Menu # 1 Entries
2020 TI$(0)="Menu # 1"
2030 TI$(3)="Blackjack":FINAME$(3)="BLACKJCK":GRA(3)=2
2040 TI$(4)="Circles":FINAME$(4)="CIRCLES":GRA(4)=1
2050 TI$(5)="Donkey":FINAME$(5)="DONKEY":GRA(5)=1
2060 TI$(6)="Character Patterns":FINAME$(6)="DOTS":GRA(6)=0
2070 TI$(7)="Music":FINAME$(7)="MUSIC":GRA(7)=0
2080 TI$(8)="Space":FINAME$(8)="SPACE":GRA(8)=1
2090 TI$(9)="Othello":FINAME$(9)="OTHELLO":GRA(9)=2
2100 TI$(10)="Maxit":FINAME$(10)="MAXIT":GRA(10)=0
2110 TI$(11)="Hat Dance":FINAME$(11)="HATDANCE":GRA(11)=0
2120 TI$(12)="Kaleidascope":FINAME$(12)="KALEID":GRA(12)=0
2130 TI$(13)="Mortgage":FINAME$(13)="MORTGAGE":GRA(13)=0
2150 RETURN
3000 ' Menu # 2 Entries
3020 TI$(0)="Menu # 2"
3030 TI$(3)="Art":FINAME$(3)="ART":GRA(3)=1
3040 TI$(4)="Piechart":FINAME$(4)="PIECHART":GRA(4)=1
3050 TI$(5)="Ball":FINAME$(5)="BALL":GRA(5)=1
3060 TI$(6)="Color Bars":FINAME$(6)="COLORBAR":GRA(6)=1
3070 TI$(7)="Circles":FINAME$(7)="CIRCLE":GRA(7)=1
3080 TI$(8)="Strings":FINAME$(8)="STRINGS":GRA(8)=1
3090 TI$(9)="Wombat Math game":FINAME$(9)="WOMBAT":GRA(9)=2
3100 TI$(10)="Yahtzee":FINAME$(10)="YAHTZEE":GRA(10)=2
3110 TI$(11)="Pong-Pong":FINAME$(11)="PONGPONG":GRA(11)=2
3120 TI$(12)="Patterns":FINAME$(12)="PATTERNS":GRA(12)=1
3130 TI$(13)="Cribbage":FINAME$(13)="":GRA(13)=2
3150 RETURN
9000 REM 80 COLUMN FILLER
9005 YY=6:XX=44:M=1
9010 LOCATE YY+1,XX+M:PRINT"▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀    ▀▀▀▀▀     ▀▀▀▀▀"
9020 LOCATE YY+2,XX+M:PRINT"▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀     ▀▀▀▀▀"
9030 LOCATE YY+3,XX+M:PRINT"  ▀▀    ▀▀▀    ▀▀▀    ▀▀▀▀   ▀▀▀▀  "
9040 LOCATE YY+4,XX+M:PRINT"  ▀▀    ▀▀▀▀▀▀▀▀      ▀▀▀▀▀ ▀▀▀▀▀  "
9050 LOCATE YY+5,XX+M:PRINT"  ▀▀    ▀▀▀▀▀▀▀▀      ▀▀▀▀▀▀▀▀▀▀▀  "
9060 LOCATE YY+6,XX+M:PRINT"  ▀▀    ▀▀▀    ▀▀▀    ▀▀▀ ▀▀▀ ▀▀▀  "
9070 LOCATE YY+7,XX+M:PRINT"▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀  ▀  ▀▀▀▀▀"
9080 LOCATE YY+8,XX+M:PRINT"▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀   ▀▀▀▀▀     ▀▀▀▀▀"
9090 LOCATE YY+11,53:PRINT"PERSONAL COMPUTER"
9100 RETURN
59999 GOTO 59999
60000 ' PROGRAM TO SWITCH BETWEEN MONO AND COLOR DISPLAY
60005 DEF SEG=0:IF (PEEK(&H410) AND &H30) = &H30 THEN DSPMODE = 1 ELSE DSPMODE = 2
60010 ADAPTER = 0:DEF SEG = &HB000:POKE 0,63:IF PEEK(0) = 63 THEN ADAPTER = ADAPTER OR 1
60015 DEF SEG = &HB800:POKE 0,63:IF PEEK(0) = 63 THEN ADAPTER = ADAPTER OR 2
60020 DEF SEG
60025 IF ADAPTER <>3 THEN BEEP:PRINT"Sorry--other display isn't installed!!":GOSUB 60080:RETURN
60030 ON DSPMODE GOSUB 60035,60060:RETURN
60035 REM switch to color/graphics adapter
60040 KEY OFF:CLS:LOCATE 10,15:PRINT"using other screen--PRESS the A key to get back here!":LOCATE ,,0
60045 DEF SEG = 0:POKE &H410,(PEEK (&H410) AND &HCF) OR &H10:DEF SEG
60050 SCREEN 1,0:SCREEN 0,1:COLOR 1,0:WIDTH 40:COLOR 7,0
60055 LOCATE ,,1,6,7:RETURN
60060 REM switch to monochrome adapter
60065 KEY OFF:CLS:LOCATE 9,5:PRINT"Using other screen.":LOCATE 10,5:PRINT"PRESS the A key to get back here!":LOCATE ,,0
60070 DEF SEG = 0:POKE &H410,(PEEK(&H410) OR &H30):DEF SEG
60075 SCREEN 0:WIDTH 80:LOCATE ,,1,12,13:RETURN
60080 FOR N = 1 TO 3000:NEXT:RETURN:'DELAY

OTHELLO.BAS

1000 REM  OTHELLO -- PET VERSION -- MODIFIED BY PATRICK   LEABO
1010 REM                                        TUCSON, ARIZONA
1020 REM                                             3-82
1025 REM NOT DONE YET BUT HAVE FUN -- PLEASE ADD A GOOD ALGORITHM TO IT
1026 REM
1030 SCREEN 0,0:COLOR 7,0:WIDTH 80:KEY OFF
1040 E$="":FOR I= 1 TO 39:E$= E$+ " ":NEXT
1050 D$= CHR$ (11)
1060 FOR I= 1 TO 20:D$= D$+ CHR$ (10):NEXT
1070 XL= 3:XH= 6:YL= 3:YH= 6
1080 DIM A(9,9),I4(7),J4(7),D$(2),P$(2):Z0= 0
1090 CLS:LOCATE 1,20:PRINT "GREETINGS FROM OTHELLO"
1100 PRINT :PRINT "OTHELLO  IS PLAYED ON AN 8 X 8 BOARD, ROWS NUMBERED"
1110 PRINT "1 TO 8  AND COLUMNS A TO H.   THE INITIAL CONFIGURATION IS"
1120 PRINT "ALL BLANK EXCEPT FOR THE CENTER FOUR SQUARES, TRY TO PLACE"
1130 PRINT "YOUR PIECE SO THAT IT OUTFLANKS YOUR  OPPONENT, CREATING "
1140 PRINT "HORIZONTAL, VERTICAL, OR DIAGONAL RUN OF OPPOSING PIECES,"
1150 PRINT "TURNING THEM INTO YOURS."
1160 PRINT
1170 PRINT:PRINT
1180 PRINT "EXAMPLE: RED OUTFLANKS BLUE, CAPTURING FOUR BLUE PIECES."
1190 PRINT "2MAKE YOUR MOVE BY ENTERING A NUMBER FOR THE ROW AND A LETTER"
1200 PRINT "FOR THE COLUMN.  "
1210 PRINT "NOTE: YOU MUST CAPTURE AT LEAST ONE OF MY PIECES IN THIS WAY "
1220 PRINT "IF IT IS POSSIBLE.  IF IT IS NOT POSSIBLE, YOU FORFEIT YOUR"
1230 PRINT "MOVE BY ENTERING 0 A FOR YOUR MOVE."
1240 PRINT :PRINT "HOW MANY PLAYERS (1 OR 2)? ";:GOSUB 3220:IF VAL (X$)= 0 OR VAL (X$)> 2 THEN 1240
1250 PRINT X$:NP= VAL (X$):PRINT
1260 IF NP= 2 THEN PRINT "PLAYER #1 GOES FIRST WHEN THE PLAY STARTS"
1270 SOUND 3000,2:INPUT "ENTER PLAYER 1,S NAME! ";P$(1):P$(1)= P$(1)+" "+ CHR$(2)
1280 SOUND 3000,2:IF NP= 2 THEN INPUT "ENTER PLAYER 2'S NAME! ";P$(2):P$(2)= P$(2)+" "+CHR$(1)
1290 IF NP= 2 THEN 1350
1300 PRINT :PRINT "SHOULD I PLAY MY BEST?";
1310 S2= 0:S4= 0:S5= 0:P$(2)= "IBM PC"
1320 GOSUB 3220:IF X$= "N"THEN PRINT "NO":GOTO 1350
1330 PRINT "YES"
1340 S2= 2:S4= 1:S5= - 2
1350 B= - 1:W= 1:PT= 0
1360 D$(B+ 1)= "RED":N$(B+ 1)= "RED "
1370 D$(0+ 1)= "BLANK"
1380 D$(W+ 1)= "BLUE":N$(W+ 1)= "BLUE"
1390 FOR K= 0 TO 7
1400 READ I4(K),J4(K)
1410 NEXT
1420 FOR I= 0 TO 9:FOR J= 0 TO 9
1430 A(I,J)= 0
1440 NEXT J,I
1450 A(4,4)= W:A(5,5)= W
1460 A(4,5)= B:A(5,4)= B
1470 SC(1)= 2:SC(2)= 2:N1= 4:Z= 0
1480 C= B:H= W
1490 FOR NN= 1 TO 3000:NEXT :CLS
1500 GOSUB 3300
1510 IF NP= 2 THEN 2020
1520 PRINT D$"DO YOU WANT TO GO FIRST ? ";
1530 PT= 1:GOSUB 3220:IF X$= "Y"THEN PRINT "YES":PT= 0:GOTO 2020
1540 PT= 1:PRINT "NO":PRINT D$E$D$"OK, I AM THINKING!"
1550 REM  COMPUTERS MOVE
1560 IF NP= 1 THEN TIME$="0:0:0":GOTO 1600
1570 IF PT= 2 THEN B1= - 1:I3= 0:J3= 0:T1= C:T2= H
1580 IF PT= 1 THEN B1= - 1:I3= 0:J3= 0:T1= H:T2= C
1590 GOTO 2030
1600 PT= PT+ 1:IF PT> 2 THEN PT= 1
1610 B1= - 1:I3= 0:J3= 0:T1= C:T2= H
1620 FOR I= YL TO YH:FOR J= XL TO XH
1630 IF A(I,J)< > 0 THEN 1790
1640 GOSUB 2740
1650 IF F1= Z0 THEN 1790
1660 U= - 1
1670 GOSUB 2780
1680 IF S1= Z0 THEN 1790
1690 IF (I= 1)OR (I= 8)THEN S1= S1+ S2
1700 IF (J= 1)OR (J= 8)THEN S1= S1+ S2
1710 IF (I= 2)OR (I= 7)THEN S1= S1+ S5
1720 IF (J= 2)OR (J= 7)THEN S1= S1+ S5
1730 IF (I= 3)OR (I= 6)THEN S1= S1+ S4
1740 IF (J= 3)OR (J= 6)THEN S1= S1+ S4
1750 IF S1< B1 THEN 1790
1760 IF S1> B1 THEN 1780
1770 IF RND (1)> 0.5 THEN 1790
1780 B1= S1:I3= I:J3= J
1790 NEXT J,I
1800 IF B1> 0 THEN 1880
1810 IF S5= 0 THEN 1840
1820 IF NP= 1 THEN S5= 0:GOTO 1610
1830 S5= 0:GOTO 1550
1840 S5= 0:PRINT D$ E$ D$"I HAVE TO FORFEIT MY MOVE"
1850 IF Z= 1 THEN 2430
1860 Z= 1
1870 GOTO 2020
1880 Z= 0
1890 PRINT D$E$D$"I WILL MOVE TO ";RIGHT$ (STR$ (I3),1)" "CHR$ (J3+ 64)
1900 GOSUB 3090 REM ▬
1910 I= I3:J= J3:U= 1
1920 GOSUB 2780
1930 SC(PT)= SC(PT)+ S1+ 1
1940 OP= PT+ 1:IF OP= 3 THEN OP= 1
1950 SC(OP)= SC(OP)- S1
1960 N1= N1+ 1
1970 PRINT D$E$D$"THAT GIVES ME ";
1980 PRINT S1;
1990 PRINT " OF YOUR PIECES"
2000 GOSUB 3390
2010 IF SC(OP)= 0 OR N1= 64 THEN 2430
2020 T1= H:T2= C
2030 PT= PT+ 1:IF PT> 2 THEN PT= 1
2040 IF PT= 2 THEN B1= - 1:I3= 0:J3= 0:T1= C:T2= H
2050 IF PT= 1 THEN B1= - 1:I3= 0:J3= 0:T1= H:T2= C
2060 BEEP
2070 TIME$="0:0:0":PRINT D$;E$D$;P$(PT)", INPUT YOUR MOVE ! ";:GOSUB 3020
2080 IF (I< 0)OR (J< 0)OR (J> 8)OR (I> 8)THEN 2040
2090 IF I< > 0 THEN 2160
2100 PRINT D$;E$D$;"ARE YOU FORFEITING YOUR TURN ? ";
2110 GOSUB 3220:IF X$< > "Y"THEN PRINT "NO":GOTO 2040
2120 PRINT "YES"
2130 IF Z= 1 THEN 2430
2140 Z1= 1
2150 GOTO 1550
2160 IF A(I,J)= 0 THEN 2190
2170 PRINT D$"SORRY,SQUARE OCCUPIED; TRY AGAIN"
2180 GOTO 2270
2190 GOSUB 2740
2200 IF F1= 1 THEN 2230
2210 PRINT D$""E$D$"SORRY,NOT NEXT TO MY PIECES; TRY AGAIN"
2220 GOTO 2270
2230 U= - 1
2240 GOSUB 2780
2250 IF S1> 0 THEN 2290
2260 PRINT D$""E$D$"SORRY,DOESN'T FLANK A ROW; TRY AGAIN"
2270 PRINT E$D$:BEEP:FOR N=1 TO 2000:NEXT
2280 GOTO 2040
2290 Z= 0:GOSUB 3150
2300 PRINT D$""E$D$""P$(PT)" THAT GIVES YOU ";
2310 PRINT S1;
2320 PRINT " PIECE";:IF S1> 1 THEN PRINT "S";
2330 PRINT :PRINT E$D$
2340 U= 1
2350 GOSUB 2780
2360 SC(PT)= SC(PT)+ S1+ 1
2370 OP= PT+ 1:IF OP= 3 THEN OP= 1
2380 SC(OP)= SC(OP)- S1
2390 N1= N1+ 1
2400 GOSUB 3390
2410 IF SC(OP)= 0 OR N1= 64 THEN 2430
2420 GOTO 1550
2430 PRINT D$;E$:PRINT E$:PRINT E$
2440 PRINT D$;E$D$;P$(1)"  HAS "SC(1)" PIECES   ";
2450 PRINT P$(2)" HAS "SC(2)" PIECES"
2460 IF SC(1)= SC(2)THEN 2510
2470 IF NP= 2 THEN 2540
2480 IF SC(1)> SC(2)THEN 2530
2490 PRINT "SORRY, I WON THAT ONE.";
2500 GOTO 2540
2510 PRINT "ITS A TIE !!";
2520 GOTO 2680
2530 PRINT "YOU WON!!!!!!";
2540 C1= SC(1)- SC(2)
2550 IF C1> 0 THEN 2570
2560 C1= - C1
2570 C1= (64* C1)/ N1
2580 PRINT "THAT WAS A ";
2590 IF C1< 11 THEN 2670
2600 IF C1< 25 THEN 2660
2610 IF C1< 39 THEN 2650
2620 IF C1< 53 THEN 2640
2630 PRINT "PERFECT GAME":GOTO 2680
2640 PRINT "WALKAWAY":GOTO 2680
2650 PRINT "FIGHT":GOTO 2680
2660 PRINT "HOT GAME":GOTO 2680
2670 PRINT "SQUEAKER"
2680 PRINT
2690 PRINT "DO YOU WANT TO PLAY ANOTHER GAME ? ";:BEEP
2700 GOSUB 3220:IF X$= "Y"THEN PRINT "YES";:RUN 1040
2710 PRINT "NO"
2720 PRINT "THANKS FOR PLAYING."
2730 CHAIN "MENU.BAS",1000
2740 F1= Z0:FOR I1= - 1 TO 1:FOR J1= - 1 TO 1:IF A(I+ I1,J1+ J)= T2 THEN 2760
2750 NEXT J1,I1:RETURN
2760 F1= 1:RETURN
2770 REM  CHECK FOR COUNT & FLANKING PIECES
2780 S1= Z0:FOR K= 0 TO 7
2790 S3= Z0:I5= I4(K):J5= J4(K):I6= I+ I5:J6= J+ J5
2800 IF A(I6,J6)< > T2 THEN 2910
2810 S3= S3+ 1:I6= I6+ I5:J6= J6+ J5
2820 IF A(I6,J6)= T1 THEN 2850
2830 IF A(I6,J6)= Z0 THEN 2910
2840 GOTO 2810
2850 S1= S1+ S3
2860 IF U< > 1 THEN 2910
2870 I6= I:J6= J
2880 FOR K1= 0 TO S3
2890 A(I6,J6)= T1:I6= I6+ I5:J6= J6+ J5
2900 NEXT K1
2910 NEXT K
2920 RETURN
2930 REM  ¶SET SEARCH LIMITS FOR COMPUTER MOVE▬
2940 IF I= YL THEN YL= YL- 1:IF YL< 1 THEN YL= 1
2950 IF I= YH THEN YH= YH+ 1:IF YH> 8 THEN YH= 8
2960 IF J= XL THEN XL= XL- 1:IF XL< 1 THEN XL= 1
2970 IF J= XH THEN XH= XH+ 1:IF XH> 8 THEN XH= 8
2980 LOCATE 1,1:PRINT TI$;"   "
2990 RETURN
3000 REM  INPUT SUBROUTINE5"
3010 PRINT D$E$"BAD MOVE; TRY AGAIN."
3020 I= - 1:J= - 1
3030 FOR K= 1 TO 2
3040 GOSUB 3220
3050 G= ASC (X$)
3060 IF 47< G AND G< 58 THEN I= G- 48:PRINT ""X$"  ";
3070 IF 64< G AND G< 74 THEN J= G- 64:PRINT ""X$"  ";
3080 NEXT :PRINT :RETURN
3090 REM BLINK COMPUTERS MOVE5
3100 LOCATE 2* J3+ 3,4* I3+ 1:COLOR 26,0:PRINT CHR$(1):COLOR 7,0
3110 I= I3:J= J3
3120 GOSUB 2940
3130 FOR NN= 1 TO 1000:NEXT
3140 RETURN
3150 REM BLINK PLAYERS MOVE5
3160 IF PT= 2 THEN CC= 0
3170 IF PT= 1 THEN CC= 2
3180 LOCATE 2* J+ 3,4* I+ 1:COLOR 26,0:PRINT CHR$(2):COLOR 7,0
3190 GOSUB 2940
3200 FOR NN= 1 TO 500:NEXT
3210 RETURN
3220 REM INPUT STATEMENTS
3230 SOUND 3000,2
3240 X$=INKEY$:IF X$="" THEN 3240 ELSE IF X$=CHR$(27) THEN CHAIN "MENU",1000 ELSE RETURN
3250 REM  PRINT SCORE
3260 LOCATE 5,36:PRINT CHR$(2);RIGHT$ ("  "+ STR$ (SC(1)),3);" ":LOCATE 19,36:PRINT CHR$(1);RIGHT$ ("  "+ STR$ (SC(2)),3);" ";:LOCATE 1,1
3270 RETURN
3280 REM BOARD DATA
3290 DATA 0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1
3300 REM ▬ OTHER OTHELLO BOARD
3310 CLS:LOCATE 1,10:PRINT "O T H E L L O"
3320 LOCATE 3,5:PRINT"1   2   3   4   5   6   7   8"
3330 FOR N=1 TO 8:LOCATE 3+2*N,1:PRINT CHR$(N+64):NEXT
3340 LOCATE 4,3  :PRINT"╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗":FOR N=1 TO 13 STEP 2
3350 LOCATE 4+N,3:PRINT"║   ║   ║   ║   ║   ║   ║   ║   ║"
3360 LOCATE 5+N,3:PRINT"╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣":NEXT
3370 LOCATE 4+N,3:PRINT"║   ║   ║   ║   ║   ║   ║   ║   ║"
3380 LOCATE 5+N,3:PRINT"╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝"
3390 FOR I= 1 TO 8
3400 FOR J= 1 TO 8:LOCATE 2* J+ 3,4* I+ 1:FACE= (A(I,J)+ 3)/2
3410 IF FACE = 1.5 THEN PRINT" " ELSE PRINT CHR$(FACE)
3420 NEXT J,I
3430 GOSUB 3250
3440 RETURN
3450 END

PATTERNS.BAS

1000 ' ###################################list
1010 ' PATTERNS    ED DAVIS 1-2-82
1020 ' Comments welcome
1030 ' but BE  KIND!
1040 ' Burlington (8-446)-2091
1050 '
1060 ' ###################################
1070 DEFINT M:COMMON MENU
1080 KEY OFF:SCREEN 0,1:COLOR 15,0,0:WIDTH 40:CLS:M%=0
1090 LOCATE 10,1:PRINT "<<-  IF THIS PRINTING IS NOT IN THE  ->>"
1100 LOCATE 11,1:PRINT "   CENTER OF THE SCREEN PRESS  'M' TO
1110 LOCATE 12,1:PRINT "   MOVE THE PICTURE TO THE RIGHT, ANY
1120 LOCATE 13,1:PRINT "    OTHER KEY TO GO TO THE PROGRAM.
1130 K$=INKEY$:IF K$="" GOTO 1130
1140 IF K$="M" OR K$="m" THEN OUT 980,2: OUT 981,43:M%=1:GOTO 1160
1150 M%=0
1160 CLS:SCREEN 0,1:COLOR 15,0,0
1170 COLOR 23 :LOCATE 2,13:PRINT"PATTERNS"
1180 LOCATE 3,13:PRINT"E.DAVIS
1190 COLOR  4,7,0:LOCATE 6,2:PRINT"Please select one of the following:
1200 LOCATE 8,9: PRINT"1- WALLPAPER (NICE!)
1210 LOCATE 9,9:PRINT"2- WAVES
1240 LOCATE 22,9:PRINT "Q- TO QUIT PROGRAM
1250 LOCATE 23,9:PRINT "M- TO MOVE SCREEN"
1260 LOCATE 4,16
1270 K$=INKEY$:IF K$="" GOTO 1270
1280 IF K$="1" THEN GOSUB 1350
1290 IF K$="2" THEN GOSUB 1410
1300 IF K$="3" THEN GOSUB 1460
1310 IF K$="4" THEN GOTO 1510
1320 IF K$="Q" OR K$="q" THEN CLS:CHAIN "MENU",1000
1330 IF K$="M" OR K$="m" THEN GOTO 1080
1340 GOTO 1160
1350 CLS :REM BEGINNING OF PATTERN PGMS E.DAVIS 1-2-82
1360 SCREEN 1,0:COLOR 0,1:IF M%=1 THEN OUT 980,2:OUT 981,43
1370 FOR I=0 TO 300:C=C+1:C=C-(3*INT(C/3)):IF C>3 THEN C=0
1380 LINE (I,0)-(300-I,191),C:NEXT
1390 FOR I=0 TO 191:C=C+1:C=C-(3*INT(C/3)):IF C>3 THEN C=0
1400 LINE (0,191-I)-(300,I),C:NEXT I:GOSUB 1770:GOTO 1350
1410 CLS ' WAVES
1420 SCREEN 1,0:COLOR 0,1:IF M%=1 THEN OUT 980,2:OUT 981,43
1430  C=3:LC=0:T#=18.8495559#
1440 FOR X=0 TO T# STEP T#/279:LINE (140,96)-(X*14.8,60*SIN(X)+96),C
1450 NEXT :GOSUB 1770:GOTO 1410
1460 CLS' ALPHA PARTICLES
1470 SCREEN 1,0:COLOR 1,0:IF M%=1 THEN OUT 980,2:OUT 981,43
1770 IN$=INKEY$:IF IN$=CHR$(27) THEN GOTO 1150 ELSE RETURN
63222 ÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷▀▀▀▀▀▀▀   ▀▀▀▀▀     ▀▀▀▀▀"
9090 LOCATE YY+11,53:PRINT"PERSONAL COMPUTER"
9100 RETURN
59999 GOTO 59999
60000 ' PROGRAM TO SWITCH BETWEEN MONO AND COLOR DISPLAY
60005 DEF SEG=0:IF (PEEK(&H410) AND &H30) = &H30 THEN DSPMODE = 1 ELSE DSPMODE = 2
60010 ADAPTER = 0:DEF SEG = &HB000:POKE 0,63:IF PEEK(0) = 63 THEN ADAPTER = ADAPTER OR 1
60015 DEF SEG = &HB800:POKE 0,63:IF PEEK(0) = 63 THEN ADAPTER = ADAPTER OR 2
60020 DEF SEG
60025 IF ADAPTER <>3 THEN BEEP:PRINT"Sorry--other display isn't installed!!":GOSUB 60080:RETURN
60030 ON DSPMODE GOSUB 60035,60060:RETURN
60035 REM switch to color/graphics adapter
60040 KEY OFF:CLS:LOCATE 10,15:PRINT"using other screen--PRESS the A key to get back here!":LOCATE ,,0
60045 DEF SEG = 0:POKE &H410,(PEEK (&H410) AND &HCF) OR &H10:DEF SEG
60050 SCREEN 1,0:SCREEN 0,1:COLOR 1,0:WIDTH 40:COLOR 7,0
60055 LOCATE ,,1,6,7:RETURN
60060 REM switch to monochrome adapter
60065 KEY OFF:CLS:LOCATE 9,5:PRINT"Using other screen.":LOCATE 10,5:PRINT"PRESS the A key to get back here!":LOCATE ,,0
60070 DEF SEG = 0:POKE &H410,(PEEK(&H410) OR &H30):DEF SEG
60075 SCREEN 0:WIDTH 80:LOCATE ,,1,12,13:RETURN
60080 FOR N = 1 TO 3000:NEXT:RETURN:'DELAY

PONGPONG.BAS

1000 GOTO 1960:' @@@@@@@@@@@@@@  PONG-PONG  E.M.DAVIS 1-1-82  @@@@@@@@@@@@@@@@
1010 LY=Y:LX=X
1020 IF D>4 THEN D=D-4:IF D<1 THEN D=D+4
1030 ON D GOSUB 1350,1360,1370,1380
1040 LOCATE 25,21:PRINT RT;
1050 S=SCREEN (Y,X)
1060 IF S=47 OR S=92 GOTO  1440
1070 IF S=178 THEN GOTO 1820
1080 LOCATE LY,LX:PRINT" ":REM ERASE OLD BALL
1090 LOCATE Y,X:PRINT "@"
1100 CT= VAL(RIGHT$(TIME$,2))
1110 RT=TGT-CT: IF RT=<0 THEN GOSUB 1720
1120 IF X=3 OR X=78 OR Y=2 OR Y=23 THEN GOSUB 1700
1130 REM CHECK KEYBOARD
1140 K$=INKEY$:IF K$="" THEN K$="."
1150 KY= ASC(K$)
1160 IF KY=47  GOTO 1540
1170 IF KY=92 GOTO 1580
1180 GOTO 1010
1190 END
1200 REM INIT FUNCTIONS
1210 CLS
1220 COLOR 0,7:CLS
1230 TIME$="00:00:00"
1240 A=1:Y=5:X=40:D=2
1250 TY%=10:TX%=10
1260 LOCATE 1,2:PRINT"╔═";
1270 FOR I=1 TO 74:PRINT"═";:NEXT I
1280 PRINT"═╗"
1290 FOR I=1 TO 22:PRINT" ║" SPC(76) "║" :NEXT I
1300 PRINT" ╚═";
1310 FOR I=1 TO 75:PRINT "═";:NEXT I
1320 PRINT "╝";
1330 RETURN
1340 REM DIRECTION SWITHES
1350 Y=Y-1:GOTO 1390
1360 X=X+1:GOTO 1390
1370 Y=Y+1:GOTO 1390
1380 X=X-1:GOTO 1390
1390 IF X>78 THEN X=78
1400 IF X<3 THEN X=3
1410 IF Y>23 THEN Y=23
1420 IF Y<2 THEN Y=2
1430 RETURN
1440 REM HIT PADDLE ROUTINE
1450 IF S=47 AND (D=1 OR D=3) THEN GOTO 1480
1460 IF S=92 AND (D=2 OR D=4) THEN GOTO 1480
1470 D=D-2
1480 D=D+1
1490 SOUND 60,1
1500 LOCATE LY,LX:PRINT" "
1510 IF D>4 THEN D=D-4
1520 IF D<1 THEN D=D+4
1530 GOTO 1030
1540 REM PLACE PADDLE PLACEMENT HERE
1550 LOCATE Y,X:PRINT "/"
1560 IF D=1 OR D=3 THEN GOTO 1610
1570 D=D-2:GOTO 1610
1580 LOCATE Y,X:PRINT "\"
1590 IF D=2 OR D=4 THEN GOTO 1610
1600 D=D-2
1610 D=D+1
1620 IF D>4 THEN D=D-4
1630 IF D<1 THEN D=D+4
1640 ON D GOSUB 1350,1360,1370,1380
1650 LOCATE LY,LX:PRINT" "
1660 S=SCREEN(Y,X):IF S=178 THEN GOTO 1820
1670 LOCATE Y,X:PRINT "@"
1680 LY=Y:LX=X
1690 GOTO 1050
1700 D=D+2:IF D>4 THEN D=D-4
1710 SOUND 38,2: RETURN
1720 LOCATE TY%,TX%:PRINT" ";
1730 TY%=2+20*RND(3):TX%=4+72*RND(4)
1740 COLOR 16,7
1750 LOCATE TY%,TX%:PRINT"▓";
1760 PLAY"MBA16B16A16B16"
1770 TIME$="00"
1780 COLOR 0,7
1790 LOCATE 25,60:PRINT BAL;
1800 BAL=BAL+1:IF BAL=6  GOTO 2560
1810 RETURN
1820 REM ********** SCORE AND WINNER CIRCLE ***************
1830 SCORE=SCORE+1
1840 PLAY "MSL16ABCDEFGABCDEFGABCDEFGP8C8P8C8P8C4"
1850 IF BAL<5 GOTO 2510
1860 CLS:LOCATE 5,30:PRINT "CONGRATULATIONS"
1870 LOCATE 10,15:PRINT" YOU HAVE HIT ";SCORE;" TARGETS USING ";TGT;" SECONDS/TARGET."
1880 IF BAL<5 GOTO 20
1890 LOCATE 24,20:PRINT"DO YOU WISH TO PLAY AGAIN (Y/N)? ";:
1900 DEF SEG:POKE 106,0
1910 IN$=INKEY$:IF IN$="" GOTO 1910
1920 IF IN$="Y" OR IN$="y" THEN GOTO 2360
1930 IF IN$="N" OR IN$="n" THEN CLS:LOCATE 12,35:COLOR 7,0:PRINT "BYE":CHAIN "MENU",1000
1940 GOTO 1910
1950 END
1960 REM INITIAL INSTRUCTIONS
1970 DEFINT M:COMMON MENU
1980 SCREEN 0,0,0:WIDTH 80:KEY OFF
1990  COLOR 7,0:CLS:LOCATE ,,0
2000 RANDOMIZE VAL(RIGHT$(TIME$,2))
2010 CLS
2020 LOCATE 5,28:PRINT" THE DAVIS PONG-PONG GAME "
2030 COLOR 0,7
2040 FOR Y=10 TO 20
2050 LOCATE Y,22:PRINT "                                       ";:NEXT Y
2060 PRINT;
2070 Y=15:X=30:LY=14:LX=29:XX=1:YY=1
2080 LOCATE LY,LX:PRINT "▓";
2090 LOCATE Y,X:PRINT "Φ";
2100 LY=Y:LX=X
2110 X=X+XX:IF X>59 THEN XX=-1
2120 IF X<23 THEN XX=1
2130 Y=Y+YY:IF  Y>19 THEN YY=-1
2140 IF Y<11 THEN YY=+1
2150 COLOR 7,0
2160 LOCATE 25,25:PRINT "PRESS ANY KEY FOR INSTRUCTIONS" ;
2170 POKE 106,0
2180 IN$=INKEY$:IF IN$="" GOTO 2080
2190 CLS
2200 LOCATE 5,10:PRINT"You are about to play a game of PONG-PONG. The object of the
2210 PRINT" game is to HIT a target with a moving ball.  Of course the target will not
2220 PRINT" stay still .  The ball's direction is controlled by inserting paddles in its"
2230 PRINT" path.  To make the game more interesting the paddles remain on the gameboard.
2240 PRINT"
2250 PRINT"       You can control the games difficulty by choosing the length of time the
2260 PRINT" target will remain in one location. You will be given FIVE targets.
2270 PRINT'
2280 PRINT"       The paddles are placed using keys '/' and '\' on the right and left
2290 PRINT" bottom row of keys.  They will place a paddle at the balls current location.
2300 PRINT
2310 PRINT"      The TARGET will look like :";:COLOR 23,0:PRINT"▓";:COLOR 7,0
2320 PRINT"
2330 PRINT"      The BALL will look like :@"
2340 LOCATE 25,20:PRINT" PRESS ANY KEY TO START GAME ";
2350 AN$= INKEY$:IF AN$="" GOTO 2350
2360 REM @@@@@@@@@@ SET TARGET TIMES@@@@@@@@@@
2370 CLS:BAL=1:SCORE=0
2380 LOCATE  5,15:PRINT" It is now time to choose the 'TARGET TIMES'.."
2390 LOCATE 8,6:PRINT "If you have just played a game the taget time was :";TGT;"seconds."
2400 PRINT"":PRINT""
2410 PRINT "   HOW MANY SECONDS (1-60) DO YOU WISH ?
2420 PRINT :PRINT
2430 PRINT "      5= OUTSTANDING
2440 PRINT "     10= EXPERT
2450 PRINT "     20= VERY GOOD
2460 PRINT "     30= NORMAL
2470 PRINT "     50= BEGINNER
2480 PRINT :PRINT :PRINT
2490 PRINT "    YOUR TIME (1-60) ";:INPUT TGT
2500 IF TGT <1 OR TGT >60 GOTO 2490
2510 GOSUB 1200:REM SET UP
2520 TIME$="00:00:00"
2530 LOCATE 25,25:PRINT"SECONDS REMAINING ON TARGET NUMBER ";
2540 GOSUB 1720:REM PLACE TARGET
2550 GOTO 1010
2560 '******* PLAYED 5 TARGETS *****
2570 IF SCORE>0 GOTO 1820
2580 CLS
2590 COLOR 23,0: LOCATE 5,31:PRINT " SORRY YOU LOSE "
2600 COLOR 7,0:DEF SEG:POKE 106,0
2610 LOCATE 10,25:PRINT "> YOU USED-UP YOUR FIVE TARGETS <"
2620 LOCATE 24,20:PRINT "DO YOU WISH TO PLAY ANOTHER GAME (Y/N) ?";
2630 AN$=INKEY$:IF AN$="" GOTO 2630
2640 IF AN$="Y" OR AN$="y" GOTO 2360
2650 IF AN$="N" OR AN$="n" THEN CLS:LOCATE 10,35:PRINT" GOOD BYE":CHAIN "MENU",1000
2660 GOTO 2630
2670 '@@@@@@@@@@@@@@@@  PONG-P0NG  ED DAVIS  @@@@@@@@@@@@@@@@@@@@@@@
2680 '@                                                            @
2690 '@       OK, it's not that great but what do you want for     @
2700 '@       a late Friday evenings work?  Please send improv-    @
2710 '@       ments.  Burlington, ext.(8-446)-2091. Thanks.        @
2720 '@                                                            @
2730 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

SAMPLES.BAS

1000 CHAIN "menu.bas",1000

STRINGS.BAS

1000 '
1010 ' STRINGS -- Patrick Leabo
1020 '
1025 POKE 106,0
1030 DEFINT M:COMMON MENU
1035 SCREEN 1
2005 CLS
2007 COLOR 1,0
2010 X0=X0 + 1.06:Y1=Y1+1.9799999#
2020 Y0=Y0-2:X1=X1-1.43
2030 IF Y0<3 THEN Y0=Y0+180
2040 IF X1<3 THEN X1 = X1 + 300
2050 IF X0>300 THEN X0=X0-300
2060 IF Y1>180 THEN Y1=Y1-180
2070 C=INT(RND*3+1)
2080 LINE (X0,Y0)-(X1,Y1),C:K=K+1
2085 IF INKEY$<>"" THEN COLOR 0,7:SCREEN 0:CHAIN "MENU.BAS",1000
2090 IF K<185 THEN 2010
2100 K=0:FOR N=1 TO 2000:NEXT:CLS:GOTO 2005

WOMBATS.BAS

1 '  a word problem generating program:                      * * WOMBATS * *
2 '  by Michael Potts    original version in Creative Computing October 1981
3 '  IBM sharing version rewritten for the Caspar Institute     January 1986
4 '  If you can read this, send us $5       box 88  Caspar  CA  95420
5 DEFINT A-Z:ST.TME$=TIME$:RANDOMIZE VAL(RIGHT$(ST.TME$,2))
6 DIM T$(47),M(42,8),O(14),XP(15),YP(15):BS$=CHR$(29)+" "+CHR$(29)
7 SP$=SPACE$(20):SS$=SP$+SP$:HRT$=CHR$(3):HRT$=HRT$+" "+HRT$+" "
8 PR.SW=1:' printer switch  0 = off   1 = on
9 TTL$=HRT$+" Wombats! "+HRT$:LW=60:GOTO 20
10 PRINT:CLS:PRINT TAB(20);TTL$:PRINT:RETURN
20 GOSUB 10:PRINT TAB(12)"A word-problem generating game"
21 LOCATE 7,10:PRINT "by Michael Potts":PRINT TAB(10);"the Caspar Institute"
22 PRINT:PRINT TAB(10);"1 January 1986":PRINT TAB(10);"{ version 2.0 }"
25 LOCATE 20,10:PRINT "{ press any key to skip the instructions. }":TI=0
26 I$=INKEY$:TI=TI+1:IF TI>250 THEN GOTO 8000
27 IF I$="" THEN 26
30 GOSUB 10:PRINT "Problem control:":PRINT:PRINT "hardest Operation:":PRINT
40 PRINT TAB(6)"1=Add  2=Subtract  3=Multiply  4=Divide":PRINT
50 PRINT TAB(18);:PRINT "your choice ? ";
60 I$=INPUT$(1):NL=VAL(I$):PRINT I$:IF I$=CHR$(13) THEN 70 ELSE 80
70 NL=4:NMX=49:NJ=1:GOTO 200
80 NL=VAL(I$):IF NL=0 OR NL>4 THEN NL=4
100 PRINT:PRINT TAB(10);:INPUT "Largest number in any problem ";I$
110 NMX=VAL(I$):IF NMX<999 THEN 140
120 PRINT "Sorry. 999 is the Largest number I know any problems about."
130 PRINT "Please enter a smaller number.":GOTO 100
140 IF NMX>2 THEN 150
145 PRINT "Too easy! More than two, please. Try again!":GOTO 100
150 PRINT:PRINT TAB(15)"5 favorite objects:":PRINT:NJ=1
160 PRINT TAB(20)NJ;":";:GOSUB 2000:IF T$="" THEN 200
170 RO$(NJ)=T$
180 IF NF=2 THEN 160
190 RO$(NJ)=T$:NJ=NJ+1:IF NJ<6 THEN 160 ELSE 220
200 FOR N=NJ TO 5:READ T$:RO$(N)=T$:NEXT
220 P1$="Damiana":PS$="her ":SX$="she"
300 AR=0:WA=0:NR=0:GOSUB 10
310 PRINT TAB(11);"What do I call you? ";:GOSUB 2000:IF NF=0 THEN 330
320 GOTO 310
330 A$=T$:GOSUB 2300:IF CF=1 THEN 400
340 PRINT:PRINT "  Whatever you want me to call you, you're a person,"
350 PRINT "and the names of persons begin with a CAPITAL letter."
360 PRINT "  Remember the SHIFT key, and please tell me again:"
370 PRINT:GOTO 310
400 FP=0:N=INT(RND(1)*3)+1:ON N GOTO 410,430,430:'                flow control
410 GOSUB 2400:IF NF=0 THEN 430:'                              another name
420 PRINT "I detect nonsense! Please try again.":PRINT:GOTO 410
430 GOSUB 500:GOSUB 520:'                                       get numbers
440 GOSUB 2700:'                                               make problem
450 IF NQ<>CA THEN 700:'                                         evaluation
460 K9=0:PRINT:PRINT "That's RIGHT, ";A$;".":GOTO 1400
470 GOTO 400
500 OP=INT(NL*RND(1)+1):'                         SUBROUTINES:    get operation
510 RETURN:'                                                    1=+ 2=- 3=* 4=/
520 IF OP>2 THEN 540:'                                         calculate numbers
530 N1=INT(NMX*RND(1)+1):GOTO 550:'                   +-
540 N1=INT(SQR(NMX)*RND(1)):IF N1=0 THEN 540:'        */
545 N2=INT(SQR(NMX)*RND(1)):IF N2=0 THEN 545
550 IF OP=1 THEN N2=INT(NMX*RND(1)):'                  +
560 IF OP=2 THEN N2=INT(N1*RND(1)):IF N2=0 THEN 530:'  -
570 IF OP=4 THEN N1=N2*N1:'                            /
590 RETURN:'                                           *
600 PRINT "I need the name of an object. ";:GOSUB 2000
610 IF NF=0 THEN 650
620 ON NF GOTO 630,600
630 PRINT:PRINT "I never heard of ";CHR$(34);T$;"s.";CHR$(34);" Sorry."
640 PRINT "Try something else, please...":GOTO 600
650 XN=INT(3*RND(1)+1):ON NX GOTO 660,670,660
660 OB$=T$
670 N=INT(5*RND(1)):RO$(N)=T$:RETURN
700 WA=WA+1:PRINT:PRINT TAB(10)" -< wrong answer >- Do you want HELP ? ";
710 I$=INPUT$(1):IF I$<>CHR$(13) THEN PRINT I$;
720 PRINT:IF I$="n" OR I$="N" THEN 730 ELSE 770
730 K9=K9+1:IF K9<3 THEN 750
740 PRINT:PRINT "SORRY, You only get three tries without help.":GOTO 780
750 WA=WA-1:PRINT:PRINT STRING$(40,"*")
760 GOSUB 4990:GOTO 450
770 PRINT CHR$(30);"  ...Okay:                     =============[HELP]======="
775 PRINT
780 PRINT "   What number do you start with";:INPUT NQ:IF NQ=N1 THEN 805
790 FP=FP+1:PRINT "     No. Read the first part again carefully:"
800 S$=S1$:GOSUB 7100:GOTO 780
805 PRINT
810 PRINT "   What is the second number";:INPUT NQ:IF NQ=N2 THEN 840
820 FP=FP+10:PRINT "     No. Read the second part again carefully:"
830 S$=S2$:GOSUB 7100:GOTO 810
840 PRINT:PRINT "   What do you do with these numbers: add";:IF NL=1 THEN 880
850 PRINT ", subtract";:IF NL=2 THEN 880
860 PRINT ",":PRINT TAB(37);"multiply";:IF NL=3 THEN 880
870 PRINT ", or divide";
880 PRINT "?"
890 I$=INPUT$(1):I=ASC(I$):IF I>95 THEN I$=CHR$(I-32)
900 IF(OP=1) AND (I$="Y") THEN PRINT "A";:GOTO 960
910 PRINT I$;:IF I$="A"THEN 960
920 IF I$="S"THEN 970
930 IF I$="M"THEN 980
940 IF I$="D"THEN 990
950 PRINT CHR$(8);:GOTO 890
960 PRINT "dd":NQ=1:GOTO 1000
970 PRINT "ubtract":NQ=2:GOTO 1000
980 PRINT "ultiply":NQ=3:GOTO 1000
990 PRINT "ivide":NQ=4
1000 IF NQ=OP THEN 1150
1010 FP=FP+(NQ*100):PRINT "     No. To do this problem, you need to ";
1020 ON OP GOTO 1030,1050,1070,1110
1030 PRINT "add.":PRINT "The clue: ";V$;" more.":PRINT "Shouldn't you add?";
1040 GOTO 1130
1050 PRINT "subtract.":PRINT "The key words: ";V$
1060 PRINT "So you subtract, right?";:GOTO 1130
1070 PRINT "multiply.":PRINT "The words ";CHR$(34);V$;CHR$(34);" are the key."
1080 PRINT "If you see several equal groups, and you want to know"
1090 PRINT "how many they total, you should multiply. Right?";:GOTO 1130
1110 PRINT "divide.":PRINT "You need to know how many ";V$;","
1120 PRINT "so you divide";N1;"into";N2;"groups. Right?";
1130 Q$=INPUT$(1):PRINT Q$:IF Q$="Y" OR Q$="y" THEN 1150
1140 PRINT "Well, ";A$;", I think the answer is YES."
1150 PRINT:PRINT "  So do this problem:   ";:PRINT N1;
1155 ON OP GOTO 1160,1170,1180,1190
1160 CA=N1+N2:PRINT "+";:GOTO 1200
1170 CA=N1-N2:PRINT "-";:GOTO 1200
1180 CA=N1*N2:PRINT "*";:GOTO 1200
1190 CA=N1/N2:PRINT "/";
1200 PRINT N2;"= ?";
1210 MF=0:PRINT CHR$(29);:GOSUB 2340
1220 PRINT I$;:T$=I$:GOSUB 2340
1230 IF MF=1 THEN 1250
1240 T$=T$+I$:PRINT I$;:GOSUB 2340:GOTO 1230
1250 NQ=VAL(T$):IF NQ<>CA THEN 1260
1255 PRINT:PRINT "     Yes. You got it now!!":GOTO 1350
1260 PRINT:PRINT:PRINT "   You need to work on your ";
1270 ON OP GOTO 1280,1290,1300,1310
1280 PRINT "addition";:FP=FP+1000:GOTO 1330
1290 PRINT "subtraction";:FP=FP+2000:GOTO 1330
1300 PRINT "multiplication";:FP=FP+3000:GOTO 1330
1310 PRINT "division";:FP=FP+4000:GOTO 1330
1330 PRINT " FACTS. "
1340 PRINT "The correct answer is";CA;".":FOR N=1 TO 2000:NEXT
1350 FOR N=0 TO 2000:NEXT:NH=NH+1:GOTO 1450
1400 AR=AR+1:PRINT AR;" right answer";:IF AR=1 THEN 1420
1410 PRINT "s";
1420 I=0:PRINT " so far.":PRINT
1430 POKE 106,0:PRINT "----{ press Q to quit - any other key to continue }----";
1440 I$=INPUT$(1):I=ASC(I$):IF I>96 THEN I$=CHR$(I-32)
1445 FOR BS=1 TO 55:PRINT BS$;:NEXT
1450 ON OP GOTO 1460,1470,1480,1490
1460 OP$="+":GOTO 1500
1470 OP$="-":GOTO 1500
1480 OP$="*":GOTO 1500
1490 OP$="/"
1500 NN=LEN(OB$):NN=20-NN
1510 R$(NR)=OB$+"s :"+LEFT$(SP$,NN)+STR$(N1)+" "+OP$+STR$(N2)+" ="+STR$(CA)
1520 IF FP=0 THEN 1540
1525 R$(NR)=R$(NR)+SPACE$(50-LEN(R$(NR)))
1530 R$(NR)=R$(NR)+"<"+MID$(STR$(10000+FP),3)
1540 IF NR=9 THEN 1570
1550 NR=NR+1:PRINT "=========================================================="
1554 IF I$="Q" THEN 1760
1555 IF PR.SW=1 AND I$="P" THEN GOSUB 7030
1560 GOTO 400
1570 NT=9
1600 GOSUB 10
1601 PRINT:PRINT "Inventory coming!":PRINT
1602 IF PR.SW=0 THEN 1610
1604 PRINT TAB(10);"Do you want a print-out ? ";:I$=INPUT$(1):I=ASC(I$)
1605 IF I>96 THEN I$=CHR$(I-32)
1606 IF I$="P" OR I$="Y" THEN IY=1 ELSE IY=0
1608 IF IY=1 AND LI>40 THEN GOSUB 7090
1610 T$="++++++++++++++++++++++++++++++++++++++++++++++++++++++":GOSUB 7000
1620 FOR NR=0 TO NT:T$=R$(NR):GOSUB 7000:NEXT
1630 T$="":GOSUB 7000
1640 T$=A$+", you have gotten"+STR$(AR)+" right,"+STR$(WA)+" wrong,":GOSUB 7000
1650 IC=INT(100*(AR/(AR+WA))):T$="   for a score of"+STR$(IC)+"%.  "
1660 IF IC<95 THEN 1680
1670 T$=T$+"Very "
1680 IF IC<90 THEN 1690
1685 T$=T$+"WELL DONE, "+A$
1690 GOSUB 7000
1700 T$="{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}":GOSUB 7000
1710 PRINT:PRINT"press ENTER for more":PRINT "or Q to quit."
1720 I$=INKEY$:IF I$="" THEN 1720 ELSE IF I$<>"Q" AND I$ <>"q" THEN 1750
1730 GOSUB 10:PRINT "   It's been a pleasure doing business with you, ";A$;"."
1740 PRINT "Please come again.":PRINT:PRINT:PRINT:END
1750 CLS:FOR NR=0 TO 9:R$(NR)="":NEXT:NR=0:GOTO 400
1760 PRINT:PRINT "Quitting time, you say. Good.":NT=NR-1:GOTO 1601
2000 NN=LEN(OB$):NN=20-NN:'                                           keyboard
2010 R$(NR)=OB$+"s :"+LEFT$(SP$,NN)+STR$(N1)+OP$+STR$(N2)+" ="+STR$(CA)
2020 T$="":PRINT ">";
2030 I$=INKEY$:IF I$="" THEN 2030
2040 I=ASC(I$):IF I<32 THEN 2070
2050 PRINT I$;
2060 T$=T$+CHR$(I):GOTO 2030
2070 IF I=8 THEN 2100
2080 IF I=13 THEN 2140
2090 GOTO 2030
2100 BS=LEN(T$)-1:IF BS<0 THEN 2130
2110 PRINT BS$;:IF BS<1 THEN 2130
2120 T$=LEFT$(T$,BS):GOTO 2030
2130 T$="":GOTO 2030
2140 NF=0:LT=LEN(T$):IF LT<17 THEN 2170
2150 PRINT:PRINT "That's too long for my memory.  Please try again."
2160 NF=2:GOTO 2270
2170 V$(1)="a":V$(2)="e":V$(3)="i":V$(4)="o":V$(5)="u"
2180 FOR K=1 TO LT:FOR J=1 TO 5:Q$=MID$(T$,K,1):IF Q$=V$(J)THEN 2210
2190 NEXT J,K
2200 GOTO 2220
2210 NF=NF+1:GOTO 2190
2220 IF LT<5 THEN 2240
2230 IF NF<INT(LT/ 4)THEN NF=1:GOTO 2270
2240 IF NF>0 THEN 2260
2250 NF=1:GOTO 2270
2260 NF=0
2270 PRINT:RETURN
2300 T$=LEFT$(T$,1):IF ASC(T$)<96 THEN 2320:'                 check for capital
2310 CF=0:GOTO 2330
2320 CF=1
2330 RETURN
2340 I$=INKEY$:IF I$="" THEN 2340
2350 I=ASC(I$):IF (I>47)*(I<58) THEN 2390
2360 IF I=13 THEN 2380
2370 GOTO 2340
2380 MF=1
2390 RETURN
2400 PRINT " I need the name of a person. ";:GOSUB 2020:'             new name
2430 IF NF=0 THEN 2490
2440 ON NF GOTO 2450,2470
2450 PRINT "I detect nonsense. I don't think ";CHR$(34);T$;CHR$(34);
2460 PRINT " is really":PRINT "someone's name. Please try again.":GOTO 2400
2470 PRINT "The names of persons begin with a capital letter."
2480 PRINT "Remember the SHIFT key. Please try again.":GOTO 2400
2490 P1$=T$:GOSUB 2300:IF CF=1 THEN 2500
2500 PRINT TAB(12-LEN(P1$));"Is ";P1$+" a he or a she? ";:GOSUB 2020:SX$=T$
2510 IF SX$="he" THEN 2550 ELSE IF SX$="she" THEN 2540
2520 PRINT "I detect nonsense. Anyway, I don't know any questions about "
2530 PRINT SX$;"'s. Please tell me again:":GOTO 2500
2540 PS$="her ":GOTO 2560
2550 PS$="his "
2560 RETURN
2600 S1$=S1$+"s":RETURN:'                                             plurals
2610 S2$=S2$+"s":RETURN
2700 N=INT(1+20*RND(1)):IF N>10 THEN 2720:'                       pick object
2710 ON N GOTO 2830,2730,2840,2740,2830,2750,2840,2760,2830,2770
2720 ON N-10 GOTO 2840,2780,2830,2790,2840,2800,2830,2810,2830,2820
2730 OB$="apple":GOTO 2900
2740 OB$="peanut":GOTO 2900
2750 OB$="wing nut":GOTO 2900
2760 OB$="ballet slipper":GOTO 2900
2770 OB$="sharp pencil":GOTO 2900
2780 OB$="red flower":GOTO 2900
2790 OB$="wombat":GOTO 2900
2800 OB$="sea urchin":GOTO 2900
2810 OB$="door knob":GOTO 2900
2820 OB$="doll shoe":GOTO 2900
2830 GOSUB 600:IF OB$<>""THEN 2900
2840 N=1+INT(5*RND(1)):OB$=RO$(N)
2900 GOSUB 10:PRINT STRING$(25,"-");"{";AR+WA+1;"}";:' new problem
2910 PRINT STRING$(25,"-"):PRINT:ON OP GOTO 3000,4000,5000,6000
3000 CA=N1+N2:N=INT(1+5*RND(1)):ON N GOTO 3010,3080,3130,3190,3240:' addition
3010 QU$="does "+P1$:V$=SX$+" takes"+STR$(N1)+", then finds"+STR$(N2)
3020 S1$=P1$+" needs something "
3030 S1$=S1$+"special at school today, so "+SX$+" takes along"
3040 S1$=S1$+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
3050 S1$=S1$+".":S2$="On the way to school, "+SX$+" sees a hat by the "
3060 S2$=S2$+"road; under it "+SX$+" finds"
3070 S2$=S2$+STR$(N2)+" more.":GOTO 4970
3080 QU$="do you":V$="you own"+STR$(N1)+", then you're sold"+STR$(N2)
3090 S1$="You look in your "+OB$+" collection and see that you own"
3100 S1$=S1$+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
3110 S1$=S1$+".":S2$="Your friend, "+P1$+", sells you"+STR$(N2)+" more."
3120 GOTO 4970
3130 QU$="does "+SX$:V$=SX$+" made"+STR$(N1)+", then makes"+STR$(N2)
3140 S1$="Last Monday, "+P1$
3150 S1$=S1$+" invented a machine that makes "+OB$+"s. "
3160 S1$=S1$+"That day, "+SX$+" made"+STR$(N1)+" "+OB$
3170 IF N1<>1 THEN GOSUB 2600
3180 S1$=S1$+".":S2$="The next day, "+SX$+" made"+STR$(N2)+" more.":GOTO 4970
3190 QU$="does "+P1$:V$=SX$+" bought"+STR$(N1)+", then buys"+STR$(N2)
3200 S1$="Yesterday, "+P1$+" bought"+STR$(N1)+" "+OB$
3210 IF N1<>1 THEN GOSUB 2600
3220 S1$=S1$+".":S2$="Today, "+SX$+" goes to the store and buys"
3230 S2$=S2$+STR$(N2)+" more.":GOTO 4970
3240 QU$="does "+SX$:V$=P1$+" found"+STR$(N1)+", then won"+STR$(N2)
3250 S1$="This morning, "+P1$+" looked in "+PS$+"pocket and found"
3260 S1$=S1$+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
3270 S1$=S1$+".":S2$="Later, "+SX$+" won"+STR$(N2)+" more in a bet with "
3280 S2$=S2$+A$+". (That's you.)":GOTO 4970
4000 CA=N1-N2:N=5*RND(1)+1:ON N GOTO 4010,4050,4100,4140,4180:'   subtraction
4010 S1$="Last week, "+P1$+" got"+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
4020 S1$=S1$+" for "+PS$+"birthday.":S2$="On Saturday, "+SX$+" lost"
4030 S2$=S2$+STR$(N2)+" of them.":QU$="does "+SX$
4040 V$=P1$+" got"+STR$(N1)+", then"+STR$(N2)+" are lost":GOTO 4970
4050 S1$="You made"+STR$(N1)+" "+OB$
4060 IF N1<>1 THEN GOSUB 2600
4070 S1$=S1$+" at school, and brought them home."
4080 S2$="On the way, you gave"+STR$(N2)+" of them to "+P1$+"."
4090 QU$="do you":V$="you make"+STR$(N1)+", then give away"+STR$(N2):GOTO 4970
4100 S1$=P1$+" was carrying "+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
4110 S1$=S1$+" in a box.":S2$="Coming down the hill, "+SX$+" fell, and"
4120 S2$=S2$+STR$(N2)+" of them rolled away."
4130 QU$="does "+SX$:V$=SX$+" had"+STR$(N2)+" roll away.":GOTO 4970
4140 S1$=P1$+" found"+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
4150 S1$=S1$+" under "+PS$+"bed.":S2$="Bill, "+PS$+"big brother, took"
4160 S2$=S2$+STR$(N2)+" of them away.":QU$="does "+P1$
4170 V$=P1$+" found"+STR$(N1)+" but Bill took"+STR$(N2):GOTO 4970
4180 S1$=P1$+" gave you"+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
4190 S1$=S1$+" because "+SX$+" had too many."
4200 S2$="Later, "+SX$+" lost all of them, and you generously gave"
4210 S2$=S2$+STR$(N2)+" back.":QU$="do you"
4220 V$=P1$+" gave you"+STR$(N1)+", you gave back"+STR$(N2):GOTO 4970
4970 QU$="How many "+OB$+"s "+QU$+" have now"
4980 S$=S1$:GOSUB 7100:S$=S2$:GOSUB 7100
4985 PRINT:PRINT "    ";QU$;:INPUT "";I$:PRINT "";:NQ=VAL(I$)
4986 IF LEN(I$)>0 THEN I$=LEFT$(I$,1):IF I$="q" OR I$="Q" THEN 1760
4990 RETURN
5000 CA=N1*N2:N=5*RND(1)+1:ON N GOTO 5010,5060,5120,5190,5260:' multiplication
5010 S1$="You get a surprise! "+P1$+" sends you"+STR$(N1)+" box"
5020 V$=STR$(N1)+" box":IF N1<>1 THEN S1$=S1$+"es":S2$=S2$+"es"
5030 S1$=S1$+" in the mail.":V$=V$+" ..."+STR$(N2)+" in each box"
5040 S2$="Each box has"+STR$(N2)+" "+OB$:IF N2<>1 THEN GOSUB 2610
5050 S2$=S2$+" in it!":QU$="do you":GOTO 4970
5060 S1$=P1$+" won"+STR$(N1)+" ticket":V$=STR$(N1)+" ticket":IF N1=1 THEN 5080
5070 GOSUB 2600:V$=V$+"s"
5080 S1$=S1$+".":S2$="When "+SX$+" traded them in, "+SX$+" got"+STR$(N2)+" "
5090 S2$=S2$+OB$:IF N2<>1 THEN GOSUB 2610
5100 S2$=S2$+" for each ticket.":V$=V$+" ..."+STR$(N2)+" for each ticket"
5110 QU$="does "+SX$:GOTO 4970
5120 S1$="A flying saucer deposits"+STR$(N1)+" metal sphere"
5130 V$=STR$(N1)+" sphere":IF N1<>1 THEN GOSUB 2600:V1$=V1$+"s"
5140 S1$=S1$+" in your kitchen sink."
5150 S2$="When "+P1$+" opens them,"+STR$(N2)+" "+OB$
5160 IF N2=1 THEN S2$=S2$+" pops" ELSE S2$=S2$+"s pop"
5170 S2$=S2$+" out of every one.":V$=V$+" ..."+STR$(N2)+" in every one."
5180 QU$="do you":GOTO 4970
5190 S1$="Your friend, "+P1$+", dug up"+STR$(N1)+" can":V$=STR$(N1)+" can"
5200 IF N1<>1 THEN GOSUB 2600:V1$=V1$+"s"
5210 S1$=S1$+" full of "+OB$+"s.":S2$="There ":IF N2=1 THEN 5230
5220 S2$=S2$+"were"+STR$(N2)+" "+OB$+"s":GOTO 5240
5230 S2$=S2$+"was 1 "+OB$
5240 S2$=S2$+" in each can.":V$=V$+" ..."+STR$(N2)+" in each can"
5250 QU$="does "+SX$:GOTO 4970
5260 S1$=P1$+" found"+STR$(N1)+" hole":V$=STR$(N1)+" hole"
5270 IF N1<>1 THEN GOSUB 2600:V$=V$+"s"
5280 S1$=S1$+" dug in "+PS$+"yard.":S2$="In each hole there "
5290 IF N2<>1 THEN S2$=S2$+"were"+STR$(N2)+" "+OB$+"s.":GOTO 5310
5300 S2$=S2$+"was 1 "+OB$+"."
5310 V$=V$+" ..."+STR$(N2)+" in each hole":QU$="does "+P1$:GOTO 4970
6000 QU$="does each one":CA=N1/N2:N=5*RND(1)+1:'                 division
6010 ON N GOTO 6020,6090,6140,6200,6240
6020 N1=N1+CA:CA=N1/(N2+1):S1$=P1$+" found a bag with"+STR$(N1)+" "+OB$
6030 IF N1<>1 THEN GOSUB 2600
6040 S1$=S1$+" in it.":S2$="After school, "+SX$+" shared them with "+PS$
6050 S2$=S2$+CHR$(29)+STR$(N2)+" sister":IF N2<>1 THEN GOSUB 2610
6060 V$="each person gets":S2$=S2$+".":N2=N2+1:GOTO 4970
6070 S2$=S2$+"nobody, but ate them all. Greedy!"
6080 QU=" does each one":N2=N2+1:GOTO 4970
6090 N1=N1+CA:CA=N1/(N2+1)
6100 S1$=P1$+"'s rich uncle gives you a rosewood box with"+STR$(N1)
6110 S1$=S1$+" "+OB$+"s in it.":S2$="You share them with"+STR$(N2)
6120 S2$=S2$+" friends who come to a tea party."
6130 V$="each friend gets":QU$="does each or you":N2=N2+1:GOTO 4970
6140 S1$="A seed packet has"+STR$(N1)+" "+OB$+" seed"
6150 IF N1<>1 THEN GOSUB 2600
6160 S1$=S1$+" in it.":S2$=P1$+" plants"+STR$(N2)+" seed"
6170 IF N2<>1 THEN GOSUB 2610
6180 S2$=S2$+" in each hole.":V$="holes "+P1$+" needs"
6190 QU$="holes does "+P1$+" need":GOTO 6290
6200 S1$=P1$+" worked for"+STR$(N1)+" day":IF N1<>1 THEN GOSUB 2600
6210 S1$=S1$+" building "+OB$+"s.":S2$="When "+SX$+" finished, "+SX$
6220 S2$=S2$+" had made only"+STR$(N2)+".":V$="days to make each"
6230 QU$="days does it take "+P1$+" to make 1 "+OB$:GOTO 6290
6240 S1$="You and "+P1$+" catch"+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
6250 S1$=S1$+" in "+OB$+" traps in the forest.":S2$="You dug"+STR$(N2)+" trap"
6260 IF N2<>1 THEN GOSUB 2610
6270 S2$=S2$+".":V$="each trap caught (as an average)"
6280 QU$="(on the average) did each trap catch"
6290 QU$=" How many "+QU$:GOTO 4980
6300 LOCATE PY,PX:PY=PY+1:RETURN
7000 PRINT T$:IF PR.SW=0 THEN 7020
7010 IF IY=1 THEN LPRINT TAB(8);T$:LI=LI+1
7020 RETURN
7030 LPRINT TAB(8);STRING$(25,"-");"{";AR+WA;"}";STRING$(25,"-"):LPRINT
7040 OD=1:S$=S1$:GOSUB 7100:LPRINT:S$=S2$:GOSUB 7100:LPRINT:OD=0
7050 LPRINT TAB(8);A$;" said: ";CA;OB$;:IF CA>1 THEN LPRINT "s";
7060 LPRINT ".":LPRINT:LI=LI+6
7070 IF LI>50 THEN GOSUB 7090
7080 RETURN
7090 LPRINT:LPRINT TAB(65);"Wombats!";CHR$(12):LI=0:RETURN
7100 LS=LEN(S$):LP=LW:IF LS<LW THEN T$=S$:GOSUB 7200:GOTO 7190
7110 IF MID$(S$,LP,1)=" " THEN 7130
7120 LP=LP-1:GOTO 7110
7130 T$=LEFT$(S$,LP-1):GOSUB 7200:T$=MID$(S$,LP+1):GOSUB 7200
7190 PRINT:RETURN
7200 IF OD=0 THEN PRINT T$:GOTO 7290
7210 LPRINT TAB(8);T$:LI=LI+1
7290 RETURN
8000 LOCATE 20,10:PRINT SS$;"    ":LOCATE 3,1
8010 PRINT "     This program makes up word problems ...with your"
8020 PRINT "help. The computer - that's me - will ask you for names"
8030 PRINT "of people and things to put in the problems it invents.":PRINT
8040 PRINT "     Before we start, you must tell me the hardest"
8050 PRINT "operation you want. For example, if you choose Subtraction,"
8060 PRINT "the problems will include Addition, too. Next, tell me the"
8070 PRINT "Largest number you want to work with. 99 is a good choice,"
8075 PRINT "but 9 is good for your first game, and 500 is very hard."
8076 PRINT "(Press [Return] only if you want to use standard settings.)"
8080 PRINT "Finally, I'll ask for the names of five favorite things."
8090 PRINT "I will reject names of persons or things longer than"
8100 PRINT "16 letters, OR that I think are nonsense. When naming"
8110 PRINT "things, write the word for ONE thing, or I will make up"
8120 PRINT "problems about thingSS! You can press Return at any time,"
8130 PRINT "and I will choose numbers and things for you.":PRINT
8190 PRINT "     Press any key to read more, or [Esc] to play.";:GOSUB 8900
8200 IF I=27 THEN 50 ELSE GOSUB 10:PRINT "Playing WOMBATS!":PRINT
8210 PRINT "     The program makes up simple word problems about the"
8220 PRINT "names, things, and numbers you give it as you play. Each"
8230 PRINT "problem consists of two sentences which tell you what to do"
8240 PRINT "with the numbers to get the right answer. Some are tricky!"
8250 PRINT "All you have to do is enter the right answer - that means"
8260 PRINT "Press the numeral keys that make the number, and then"
8270 PRINT "press the Enter key. (The Return key works, too.) Good"
8280 PRINT "players like to press the NumLock key, and use the keypad"
8290 PRINT "for speed. You get credit for being RIGHT, not for"
8300 PRINT "being FAST. Enjoy yourself, and PAY ATTENTION.":PRINT
8310 PRINT "     If you make a mistake, you can accept help by pressing"
8320 PRINT "Y or can try a problem again by pressing N - but you only"
8330 PRINT "get 3 tries. It is okay to use paper and pencil, but try"
8340 PRINT "not to count on your fingers. Help asks you questions that"
8350 PRINT "make the problem easier to understand.":PRINT
8360 PRINT "     Good Luck! Press T to read more about Wombats."
8490 PRINT "             Press the Enter key to play.";
8500 I$=INPUT$(1):PRINT I$:IF I$=CHR$(13) THEN 30
8505 IF I$="t" OR I$="T" THEN 8600
8510 PRINT:PRINT "  Computers are very exacting. You pressed the ";
8520 IF I$=" " THEN PRINT "[space]" ELSE PRINT CHR$(34);I$;CHR$(34)
8530 PRINT "but the computer asked for the Enter key. Please try again.":PRINT
8540 PRINT "   Press the Enter key to play.";:GOTO 8500
8600 GOSUB 10:PRINT "Teacher features":PRINT
8610 PRINT "     Wombats keeps track of errors made during play, and"
8620 PRINT "prints a diagnostic code with the problems missed. You can"
8630 PRINT "find an explanation of the codes, and recommended remedies"
8640 PRINT "in the book of instructions, TEACHING with an IBM PC.":PRINT
8650 PRINT "     If you have a printer, you can make the game more"
8660 PRINT "interesting by turning the printer switch on - see line 8"
8670 PRINT "and the instructions. Then, whenever an inventory of problems"
8680 PRINT "is ready for display, the player will be asked if a print-out"
8690 PRINT "is desired. Players can also print each problem by pressing"
8700 PRINT "P after entering the correct answer.":PRINT
8710 PRINT "     You may want to change Wombats in a number of ways;"
8720 PRINT "you may even want to take out the wombats (Oh, no!). Please"
8730 PRINT "refer to the instructions for help customizing the program.":PRINT
8740 PRINT "     Send us $5 and your thoughts: the Caspar Institute,"
8750 PRINT "Box 88, Caspar  CA  95420. Please make copies of this program,"
8760 PRINT "but DO NOT remove the sharing information. Thank you."
8770 GOTO 8490
8900 I$=INPUT$(1):I=ASC(I$):RETURN
9000 DATA wombat,rocking chair,tractor,dump truck,umbrella

WOMBATS.DOC

          {H} {H}  Wombats! {H} {H}

  A word-problem generating game



by Michael Potts
the Caspar Institute

1 January 1986
{ version 2.0 }


{ press any key to skip the instructions. }

	Wombats was written to help 7 to 11 year-old learners master
word problems and number sentences. Since I expect the program to
engage this audience across as much of their learning spectrum as
possible, vocabulary for the skeletal sentences is at an
appropriate level, precision in capitalization is insisted upon,
and the problems assume a greater mastery of addition and
subtraction than of the two dimensional operations. Wombats
appeals to the audience's love of fantasy and humor, knowing that
instruction by computer can be less than fun.

	In the classroom, Wombats attracts and engages most students
for awhile, but some students willingly become repeat players. I
try to extend to them the same consideration I want from programs
I use for my own work and enjoyment: if a learning program, or
any program that I return to again and again, forces me to review
a lengthy set of credits, instructions, and warnings every time I
start it, I get impatient. I'm here to work, computer, so let's
get down to it!
	In Wombats, impatience is accommodated. Pressing [Return]
twice in rapid succession gets you past the introduction quickly.
(A third [Return] gets you in trouble. Discerning when one may
safely be impatient, and when one should give a full and
thoughtful answer, is, after all, one of the most important
learnings one may accomplish. When Wombats asks what to call you,
it is best to answer.)
	For the patient and curious, Wombats offers instructions:

                   {H} {H}  Wombats! {H} {H}

     This program makes up word problems ...with your
help. The computer - that's me - will ask you for names
of people and things to put in the problems it invents.

     Before we start, you must tell me the hardest
operation you want. For example, if you choose Subtraction,
the problems will include Addition, too. Next, tell me the
Largest number you want to work with. 99 is a good choice,
but 9 is good for your first game, and 500 is very hard.
(Press [Return] only if you want to use standard settings.)
Finally, I'll ask for the names of five favorite things.
I will reject names of persons or things longer than
16 letters, OR that I think are nonsense. When naming
things, write the word for ONE thing, or I will make up
problems about thingSS! You can press Return at any time,
and I will choose numbers and things for you.

     Press any key to read more, or [Esc] to play.

	Some people object to personifying the computer by letting
it calls itself "I", humans are, after all, superior to the
products of silicon-based technology, and thus uniquely entitled
to "I" and "me". Theory and in-bred distaste for the pathetic
fallacy aside, children (and almost all other computer users) are
comfortable thinking about computers and other pets as persons of
a possibly limited sort, but persons nonetheless. I want Wombats
to be an enabler, working as a patient, predictable, and
supportive coach to the player, so I endow it with a synthetic
personality in the instructions, which are meant to be read by
the player, not necessarily a teacher.
	Instructions like this, printed on paper, are for scholars
or those of us who prefer to see directions on a non-volatile
medium like paper. The on-screen instructions are a middle
ground, for the timid, curious, or forgetful, and we must
remember our audience.
	The best way to learn to play a game should be, to play it.
This exhortation is hardly needed by younger players, and the
play of the program should be sufficiently self-explanatory to
help them through the first rounds. The challenge for a
programmer is to anticipate all the possible wrong answers - an
instructive exercise which clearly separates theoreticians from
practical teachers who have seen it all! Programs like Wombats,
which have been through years of classroom testing, acquire deep
layers of error trapping to help the neophyte. These elaborations
of the mainstream of the program may take more time to perfect
than the mainstream itself, and will be used only rarely; for
their users, they can make the difference between enjoyable
learning and frustrated rejection.

How Wombats gets         Wombats chooses numbers differently for
problems:            addition and subtraction, the one-
a sidetrip for       dimensional operations, and multiplication
programmers          and division, the two-dimensional. For the                        former, any number up to and including the
                     maximum allowed may appear in the top of the
                     problem. Because we have identified the
                     audience for this program to be children who
                     have mastered the one-dimensional operations,
                     and are mastering the two-dimensional, the
                     maximum number to appear in multiplication
                     and division problems, including the result,
                     will be the specified Largest number; the
                     operands will be less than or equal to the
                     square root of the largest number. If, for
                     example, we had allowed 99 as our largest
                     number, the program might pose the problem
                     99 + 99 = ? but would never ask for more than
                     9 * 9 = ? or 81 / 9 = ? .

                   {H} {H}  Wombats! {H} {H}

 Problem control:

hardest Operation:

     1=Add  2=Subtract  3=Multiply  4=Divide

                 your choice ? 4

         Largest number in any problem ? 99

              5 favorite objects:

                    1 :>wombat
                    2 :>plum blossom
                    3 :>backhoe
                    4 :>eggplant
                    5 :>teddy bear

What do I call you?  >Damiana

	If a player is ready to attempt problems of standard
difficulty - all operations, with numbers as large as 99 - and
will accept the computer's inventory of favorite objects, she may
press [Return] when asked to choose the hardest Operation, and
the entries will be made by the computer, and the player will be
asked for an appellation. Experience shows that children will
frequently "fool" the computer by offering a pseudonym. The
persistance of the computer in calling them anything they choose
is strangely delightful, and a clue to the success of Wombats.
	As soon as these parameters are completed, the play begins.

Playing WOMBATS!

     The program makes up simple word problems about the
names, things, and numbers you give it as you play. Each
problem consists of two sentences which tell you what to do
with the numbers to get the right answer. Some are tricky!
All you have to do is enter the right answer - that means
Press the numeral keys that make the number, and then
press the Enter key. (The Return key works, too.) Good
players like to press the NumLock key, and use the keypad
for speed. You get credit for being RIGHT, not for
being FAST. Enjoy yourself, and PAY ATTENTION.

     If you make a mistake, you can accept help by pressing
Y or can try a problem again by pressing N - but you only
get 3 tries. It is okay to use paper and pencil, but try
not to count on your fingers. Help asks you questions that
make the problem easier to understand.

     Good Luck! Press T to read more about Wombats.
             Press the Enter key to play.

The game looks like this:

-------------------------{ 1 }---------------------------

Damiana worked for 49 days building door knobs.

When she finished, she had made only 7.


     How many days does it take Damiana to make 1 door knob?

Damiana correctly responds by pressing the 7 and the [Enter] or
[Return] keys, and the program responds:

That's RIGHT, Damiana.
 1  right answer so far.

----{ press Q to quit - any other key to continue }----
	Wombats also for new names from time to time, offering
players an opportunity for hilarity. The computer, however, is
not too easily fooled, as this sample shows:

I need the name of a person.  >sienna
The names of persons begin with a capital letter.
Remember the SHIFT key. Please try again.
I need the name of a person.  >Sienna
   Is Sienna a he or a she?   >she

	The program counts vowels and rejects names with too few for
its length:

I need the name of a person.  >Snnx
I detect nonsense. I don't think "Snnx" is really
someone's name. Please try again.
I need the name of a person.  >

	Periodically, Wombats also refreshes its object inventory by
asking for something new. This is the opportunity that children
twist to their own ends, entering progressively more outrageous
objects, people, and agencies, in an effort to "test" the
tolerance of the computer:

I need the name of an object.>lawn mower

	In due course, a problem about lawn mowers is proposed:

-------------------------{ 4 }---------------------------

Last Monday, Damiana invented a machine that makes lawn
mowers. That day, she made 63 lawn mowers.

The next day, she made 32 more.


    How many lawn mowers does she have now?

	Suppose Damiana subtracts instead of adding, and answers 31.
The program replies,

          -< wrong answer >- Do you want HELP ?

An affirmative answer - press the Y - starts the help dialogue:

  ...Okay:                     =============[HELP]=======

   What number do you start with? 63

   What is the second number? 32

   What do you do with these numbers: add, subtract,
                                    multiply, or divide?
Subtract
     No. To do this problem, you need to add.
The clue: she made 63, then makes 32 more.
Shouldn't you add?y

  So do this problem:    63 + 32 = ?

	In this example, Damiana repeated her error, and the
computer showed her the clue that shows this to be an addition
problem.

	If the player cannot find the numbers to manipulate, the
program retypes the sentences one at a time. In this example, the
player perseverates in the wrong answer; equally stubbornly, the
computer repeats the first part over again.

  ...Okay:                     =============[HELP]=======

   What number do you start with? 6
     No. Read the first part again carefully:
You and Sienna catch 12 ballet slippers in ballet slipper
traps in the forest.

   What number do you start with? 6
     No. Read the first part again carefully:
You and Sienna catch 12 ballet slippers in ballet slipper
traps in the forest.

   What number do you start with? 12

   What is the second number? 12
     No. Read the second part again carefully:
You dug 6 traps.

   What is the second number? 6

   What do you do with these numbers: add, subtract,
                                    multiply, or divide?
Add
     No. To do this problem, you need to divide.
You need to know how many each trap caught (as an average),
so you divide 12 into 6 groups. Right?y

  So do this problem:    12 / 6 = 3

   You need to work on your division FACTS.
The correct answer is 2 .

	In this example, the player made every mistake available
(and some of them twice). We might be tempted to suspect the
player of making mistakes just to explore the program. This is a
rarified and valuable kind of learning, to be encouraged.
Another problem reveals a built-in error - it could be called a
bug, but I prefer to call it a feature:

-------------------------{ 10 }---------------------------

This morning, Rochelle looked in her pocket and found 42
butterflys.

Later, she won 33 more in a bet with Damiana. (That's you.)


    How many butterflys does she have now?

	English pluralizes irregularly, but computers are good at
identical repetition. The simple algorithm for pluralizing is,
add an "s" to the singular; the exceptions are numerous, and
frequently curious. If you can devise an algorithm for correcting
the irregularities, you are invited to "patch" the program. In
the meantime, I rationalize this feature by noting that children
usually spot the computer's error immediately, and are delighted
that it should make such a stupid mistake. The player's mastery
of the concept of irregular pluralization is reinforced. There is
danger, of course, for students who have not mastered the
concept, and accept everything the computer says as gospel.
Garbage In, Gospel Out!

	After ten problems (or when the player accepts the
computer's invitation to Quit) an inventory of the last set of
problems is displayed:

Inventory coming!

++++++++++++++++++++++++++++++++++++++++++++++++++++++
rocking chairs :        40 - 2 = 38
lawn mowers :           1 * 1 = 1
umbrellas :             43 - 40 = 3
red flowers :           34 - 20 = 14
red flowers :           31 - 25 = 6               <2111
wombats :               1 * 3 = 3
ballet slippers :       12 / 6 = 2                <4112
mongooses :             1 * 4 = 4
wing nuts :             23 + 0 = 23
butterflys :            42 + 33 = 75

Damiana, you have gotten 8 right, 2 wrong,
   for a score of 80%.

If the player is doing well, the computer adds a "WELL DONE" (for
better than 90% correct) and even "Very WELL DONE" (for better
than 95%.) For every problem where Help was accepted and mistakes
were made in deciphering the problem, a diagnostic code - the
last column of four digit numbers - is included.Teacher features

     Wombats keeps track of errors made during play, and
prints a diagnostic code with the problems missed. You can
find an explanation of the codes, and recommended remedies
in the book of instructions, TEACHING with an IBM PC.


Diagnostic codes

	The units digit and the tens digit reflect the number of
times the player missed the first and second numbers in the
problem (respectively.) For example, in the lengthy example of
Help given two pages previously, the last two digits of the
diagnostic code would be 12, showing that the player
misunderstood the first number in the problem twice, and the
second number once.
	The hundreds place reflects errors in the operation that the
player proposes to solve the problem: the numeral represents the
incorrect operation proposed. To refer again to the lengthy Help
dialogue two pages back, the player proposes to add when the
problem requires division; the diagnostic code would show a 1 in
the hundreds place for addition, using the same numeration as in
the program's set-up:

     1=Add  2=Subtract  3=Multiply  4=Divide

	The thousands place reflects errors in solving the numeric
problem. Again, to take the example, a mistake is made in
division, and so the diagnostic code will show a 4 in the
thousands place, signifying a division error (since the numeric
codes for operations, as noted above, are used here as well.)

	The diagnostic code for the example (as can be seen in the
sample Inventory on the previous page) is 4112. As we noted in
the example, a diagnostic code like this may show us that the
student is not ready for this kind of work (in which case most
problems will be followed by full diagnostics), or that her
attention was wandering momentarily, or (most likely) that she
was fooling the computer to see how deeply it was prepared to
help.
	When a student's comprehension of concept or operation is
troubled, the diagnostic codes will reflect the trouble. A string
of errors showing a digit in the hundreds place only indicates a
problem with understanding the operation required by word
problems. A string of errors in the thousands place might
indicate a need to polish addition or multiplication facts.
Errors in the less significant digits - the units and tens -
reveals inattention of reading problems.More Teacher Features

     If you have a printer, you can make the game more
interesting by turning the printer switch on - see line 8
and the instructions. Then, whenever an inventory of problems
is ready for display, the player will be asked if a print-out
is desired. Players can also print each problem by pressing
P after entering the correct answer.

	To make changes in the program, you must attack your
computer's BASIC interpreter, at least in a very minor way. The
"switch" that tells the program whether or not a printer is
connected is in line number 8, which looks like this:

	8 PR.SW=0:' printer switch  0 = off   1 = on

As you may remember from the earlier chapter on Controlling
Computers, you may change this line by LISTing it, then moving
the cursor (with the cursor arrows) over the 0, typing a 1, and
pressing [Return]. To make the change permanent, you must
SAVE"WOMBATS onto your disk.

     You may want to change Wombats in a number of ways;
you may even want to take out the wombats (Oh, no!). Please
refer to the instructions for help customizing the program.

	"If a program is finished, it's obsolete." Like Mrs.
Winchester's famous mystery house, a program is alive only so
long as someone is tinkering with it. This fact is acknowledged
at the mainframe level of computing by the expensive presence of
"hackers" who are constantly tweaking and tuning their machine's
capabilities ...one would hope, to the betterment of its
usefulness (although this is not always the case.) Programs that
provide users with adaptability are much more useful, at any
level, than routines which are unalterable; the most basic lesson
computers are here to teach us is the necessity and delight of
adaptability. Locked programs, which for reasons of security or
profit are unalterable and often uncopyable, teach someone else's
lessons, and in many cases, such lessons are exquisite (as we
discussed earlier in the chapter,) but they can also be prey to
inaccuracy, time, and our love for variety.
	Children reflect this in their delight in changing the
objects and persons in the Wombats problems. The teacher who
takes on the role of Program Maintainer, can add to this delight
by changing Wombats's favorite things from time to time. These
are contained in two places. One set are here:

	9000 DATA wombat,rocking chair,tractor,dump truck,umbrella

and the other set in these lines:

2730 OB$="apple":GOTO 2900
2740 OB$="peanut":GOTO 2900
2750 OB$="wing nut":GOTO 2900
2760 OB$="ballet slipper":GOTO 2900
2770 OB$="sharp pencil":GOTO 2900
2780 OB$="red flower":GOTO 2900
2790 OB$="wombat":GOTO 2900
2800 OB$="sea urchin":GOTO 2900
2810 OB$="door knob":GOTO 2900
2820 OB$="doll shoe":GOTO 2900

Changes may be accomplished as described above, but Prudent
Programming Practice requires us to maintain a known-to-be-
working version as well as a version under development. Serious
changes in the program are possible, and certainly desirable; the
serious tinkerer should use lots of common sense in planning and
executing these changes. As we have mentioned before, education
should proceed for all across the widest possible spectrum, and
the teacher-maintainer is certainly included: in learning to
program, and to observe the effects on the player-learners of my
efforts, and continually improving the enhancements, continues an
exciting and time-consuming process, in which adding to my own
knowledge has always been the largest component.

	Teaching the computer's linear language to follow the
strange and wonderful twists of the English language offers an
opportunity to perfect our understanding of both. The linguistic
format of Wombats's problems is,

S1$:	< Person > [ action ] { First number } < Object >[s]

S2$:  < P's Gender > [ action ] { Second number }

where the enclosures denote <data provided by the player>, [data
provided by the program], and {data within ranges specified at
the start.} In the simplest case, a problem that reads like this,

S1$:{Damiana}[ needs something special at school today, so]<
she>[ takes along]{ 6}[ ]<rattlesnake>[s.]

S2$:[On the way to school,]< she>[ sees a hat by the road; under
it]< she>[ finds]{ 13}[ more.]

	The code that puts those sentences together looks like this:

3020 S1$=P1$+" needs something "
3030 S1$=S1$+"special at school today, so "+SX$+" takes along"
3040 S1$=S1$+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
3050 S1$=S1$+".":S2$="On the way to school, "+SX$+" sees a hat by
the "
3060 S2$=S2$+"road; under it "+SX$+" finds"
3070 S2$=S2$+STR$(N2)+" more.":GOTO 4970

A glossary of the symbols in that section:

symbol   what it represents                 example value

S1$      First sentence of problem          [ see   ]
S2$      Second sentence                    [ above ]
         	These two sentences are
         put together by the computer
         using the variables below as
         building blocks.

P1$      First person                       Sienna
SX$      Person's gender pronoun             she
OB$      the Object in question             rattlesnake
         	These are supplied by the
         player as prompted by the
         program.

N1       First number                       6
N2       Second number                      13
         	Randomly chosen by the
         computer within limits set at
         the start of the program.

STR$(N1) a string derived by the             6
         computer consisting of a space
         (or, for a negative number, a
         hyphen) and the number or
         variable in parentheses.


	Each problem also has an associated QUestion, Correct
Answer, and key phrase V$ determining the operation to be used in
solving the problem for use by Help. For this problem, they are
supplied at the start of the addition programs and by the line,

       3010 QU$="does "+P1$:V$=SX$+" takes"+STR$(N1)+", then finds"+STR$(N2)

Subroutines: black boxes we need not understand

	Repetitive and complicated steps are often hidden in
subroutines or at the beginnings and ends of processes. Two such
external routines are used in this code segment.

GOSUB 2600


GOTO 4970



Pluralizer  (a subroutine)
	Adds an "s" to a working string T$

Problem poser (end of program generation)
	Pops the question and gets the answer.
All problem generators end with GOTO 4970
unless they completely rebuild the question,
in which the GOTO 4980
	A rudimentary understanding of BASIC is needed if you want
to decode, change, or augment the addition (starting at line
3000), subtraction (from line 4000), multiplication (from line
5000), or division (line 6000.) As complex and lengthy as it is,
Wombats uses less than a third of the IBM's Basic workspace, and
so there is plenty of room for growth!

	Among the division problems are two trick questions, wherein
the trick is that the second number is one less than the divisor
because an additional share is implicitly included in the
problem:

Sienna found a bag with 12 rocking chairs in it.
After school, she shared them with her 3 sisters.

    How many rocking chairs does each one have now? 4

          -< wrong answer >- Do you want HELP ?

	Since these are four to share the windfall - Sienna and her
three sisters - the correct answer is 3.
	The code that starts the question, calculates the normal
Correct Answer, and randomly chooses the problem is contained in
line 6000 and 6010. This problem results only when the N
calculated in line 6000 is 1 and the program is sent to line
6020, where the problem itself is generated. Note the way an
extra share of objects is added and the Correct Answer
recalculated in line 6020.

6000 QU$="does each one":CA=N1/N2:N=5*RND(1)+1:'                 division
6010 ON N GOTO 6020,6090,6140,6200,6240
6020 N1=N1+CA:CA=N1/(N2+1):S1$=P1$+" found a bag with"+STR$(N1)+" "+OB$
6030 IF N1<>1 THEN GOSUB 2600
6040 S1$=S1$+" in it.":S2$="After school, "+SX$+" shared them with "+PS$
6050 S2$=S2$+CHR$(29)+STR$(N2)+" sister":IF N2<>1 THEN GOSUB 2610
6060 V$="each person gets":S2$=S2$+".":N2=N2+1:GOTO 4970


	When adding new problems, you need not wait patiently while
the computer comes up with the right combination - which might
take 20 or more problems as the program stands now. Because BASIC
is superbly responsive to minor changes, you can change the line
that chooses the next problem's operation from

500 OP=INT(NL*RND(1)+1):'                     SUBROUTINES:    get operation

		to

500 OP=4:'INT(NL*RND(1)+1):'                  SUBROUTINES:    get operation

for example, to test a new division problem. The addition of the
colon and apostrophe tell the interpreter to ignore the rest of
the line. With this change in place, only division problems will
result. To include a new problem, the first of the operation's
lines must be changed as well. To add a sixth division problem,
line 6000 would changed to

6000 QU$="does each one":CA=N1/N2:N=6*RND(1)+1:'                 division

but to test the problem, we might wish first to change the line to

6000 QU$="does each one":CA=N1/N2:N=6:'*RND(1)+1:'               division

so that only the sixth problem will appear. When you are
confident that the new problem is correct and literate, remember
to take the comment marks (the :') out of the program. Otherwise,
the players may complain that they are getting only one problem.

Credit where credit is due:

     Send us $5 and your thoughts: the Caspar Institute,
Box 88 / Caspar  CA  95420. Please make copies of this
program, but DO NOT remove the sharing information.

	By all means, if you correct any bugs or add to the program
significantly, take credit yourself. The credits are in the first
lines of the program, but there is plenty of room for more
credits; use lines 11 - 19. A credit line might look like,

     11 ' additional problems added by R. Elkan  10 Jan 86

3897 words
11 January 1986
revised 10 June 1986


YAHTZEE.BAS

1000 '     YATZEE
1010 ' ORIGINAL BY JL HELMS & MF PEZOK FOR CCII
1020 ' CORONADO, CA
1030 ' ADAPTED TO IBM PC BY PATRICK LEABO
1040 ' TUCSON, AZ
1050 '
1060 DEFINT A-Z
1070 DIM C(5):DIM K(18,7):DIM F(5):DIM A$(7)
1080 DIM S(6,5):DIM M(13),TN(6),DU(6):KEY OFF:COLOR 7,0:WIDTH 80
1090 SCREEN 0,1:RESTORE 1150:FOR N= 1 TO 6:READ TN(N):NEXT
1100 COMMON MENU
1110 GOSUB 5090
1120 C1= 39:C2= 63:C3= 33:C4= 56
1130 GOSUB 4660
1140 CLS:GOSUB 4430
1150 DATA 49,51,53,54,56,61
1160 GOSUB 6820:REM  draw yatzee board
1170 RANDOMIZE VAL(RIGHT$(TIME$,2))
1180 LOCATE 25,1
1190 PRINT "HOW MANY PLAYERS?  ";:LOCATE ,,1:GOSUB 2090
1200 GOSUB 7100: N=ASC(KB$)-48
1210 IF N< 1 OR N> 5 THEN 1180
1220 IF N< 5 THEN GOSUB 6000
1230 IF CC= 1 THEN GOSUB 5480
1240 FOR A= 1 TO N
1250 LOCATE 25,1:PRINT STRING$(70," ");:LOCATE 25,1
1260 PRINT "PLAYER NUMBER "A;" NAME PLEASE  ";
1270 GOSUB 2090:LINE INPUT ;A$(A):IF A$(A)= "" THEN BEEP:GOTO 1250
1280 A$(A)=LEFT$(A$(A),9)
1290 NEXT A
1300 IF CC= 1 THEN N= N+ 1:A$(N)= "IBM PC"
1310 LOCATE 23,1
1320 A= 0
1330 REM
1340 REM   NEXT ROLL PRESET
1350 REM
1360 A= A+ 1:IF A> N THEN A= 1
1370 H= 0:GOSUB 5340
1380 IF A= 0 THEN 4760
1390 IF K(18,A)= 2 THEN 1360
1400 LOCATE 23,1:PRINT STRING$(60," ");
1410 LOCATE 23,4* (A- 1)+ 14
1420 PRINT A$(A);
1430 REM
1440 REM   INITIAL ROLL
1450 REM
1460 H= H+ 1:MR= 0
1470 FOR B= 1 TO 5
1480 J= B- 1:C(B)= INT (6* RND (1)+ 1)
1490 DIE= C(B):F(B)= 0
1500 GOSUB 5250
1510 GOSUB 5530
1520 NEXT B
1530 IF A* CC= N THEN 2140
1540 REM
1550 REM  PLAYER SELECTS QTY TO ROLL
1560 REM
1570 GOSUB 7080
1580 IF H> 2 THEN 1940
1590 POKE 106,0:PRINT " HOW MANY DICE TO ROLL AGAIN? ";:LOCATE ,,1:GOSUB 2080:GOSUB 7100:F$=KB$:PRINT F$;:F=ASC(F$)-48:LOCATE ,,0
1600 IF F= - 1 THEN GOSUB 35000
1610 IF F< 0 OR F> 5 THEN 1570
1620 IF F= 0 THEN 1940
1630 IF F= 5 THEN 1430
1640 REM
1650 REM  PLAYER SELECTS DICE TO ROLL
1660 REM
1670 H= H+ 1
1680 GOSUB 7080
1690 FOR NN= 1 TO 4:F(NN)= 0:NEXT
1700 PRINT " ROLL WHICH";F;"DICE AGAIN   ";:LOCATE ,,1
1710 GOSUB 2090:FOR ND= 1 TO F:
1720 GOSUB 7100:F$=KB$::F(ND)= ASC(F$)- 48:GOSUB 2120:IF F(ND)= 0 AND  ND= 1 THEN  ND= F:GOTO 1740
1730 IF F(ND)< 1 OR  F(ND)> 5 THEN 1720
1740 PRINT F(ND);:NEXT
1750 X= 2:XF= 0
1760 FOR J= 1 TO F
1770 IF F= 1 THEN 1790
1780 IF F(J)= F(J+ 1)THEN X= 1
1790 IF F(1)= 0 THEN XF= 1
1800 NEXT J:IF XF= 1 THEN H= H- 1:GOTO 1570
1810 ON X GOTO 1680,1820
1820 REM
1830 REM  PLAYER ROLLS DICE AGAIN
1840 REM
1850 FOR B= 1 TO 4
1860 IF F(B)= 0 THEN 1920
1870 C(F(B))= INT (6* RND (1)+ 1)
1880 DIE= C(F(B)):J= F(B)- 1
1890 GOSUB 5250
1900 GOSUB 5530
1910 F(B)= 0
1920 NEXT B
1930 GOTO 1540
1940 REM
1950 REM   PLAY BOARD NUMBER
1960 REM
1970 GOSUB 7080
1980 PRINT " PLAY BOARD NUMBER?  ";:LOCATE ,,1:GOSUB 2080:GOSUB 7100:I$=KB$:I=ASC(I$)- 48:LOCATE ,,0:IF I> 9 THEN I= I- 7
1990 GOSUB 2120:IF I> 9 THEN PRINT CHR$ (I+ 55);:GOTO 2010
2000 PRINT I;
2010 IF I< 1 OR I> 13 THEN 1970
2020 IF I= 12 AND K(12,A)> - 1 THEN 2140
2030 IF K(I,A)= 0 THEN 2140
2040 LOCATE 24,1:BEEP
2050 PRINT "NO - NO - DUMMY - - TRY AGAIN";:FOR ND=1 TO 1500:NEXT:LOCATE 24,1:PRINT STRING$(60," ");
2060 LOCATE 25,1:PRINT STRING$(60," ");:LOCATE 25,1
2070 GOTO 1980
2080 REM  HIGH PITCH CLICK
2090 PLAY "L64T200N70":RETURN
2100 REM  GLISSANDO SOUND
2110 PLAY "MBt255MLL64O5CC#DD#EFF#GG#AA#B":RETURN
2120 ' LO PITCH CLICK
2130 PLAY "L64T200N46":RETURN
2140 REM
2150 REM  DICE LOGIC
2160 REM  CLEAR/SET S(M,K)
2170 REM
2180 FOR M= 0 TO 6
2190 FOR K= 0 TO 5
2200 S(M,K)= 0
2210 NEXT K
2220 NEXT M
2230 FOR J= 1 TO 5
2240 X= C(J):S(X,0)= S(X,0)+ 1
2250 P= S(X,0):S(X,P)= J
2260 NEXT J
2270 REM
2280 REM  SET S(0,K)=M SEQUENCE BY QTY
2290 REM
2300 X= 0
2310 FOR J= 5 TO 1 STEP - 1
2320 FOR M= 6 TO 1 STEP - 1
2330 IF S(M,0)< > J THEN 2350
2340 S(0,X)= M:X= X+ 1
2350 NEXT M
2360 NEXT J
2370 IF A* CC= N THEN 2740
2380 IF I> 6 THEN 2460
2390 REM
2400 REM  CHECK PLAYER BOARD 1-6
2410 REM
2420 GOSUB 6110
2430 IF X= - 1 THEN 2720
2440 K(I,A)= I* S(S(0,X),0)
2450 GOTO 3980
2460 REM
2470 REM  CHECK PLAYER BOARD 7-13
2480 REM
2490 ON I- 6 GOTO 2500,2520,2540,2560,2610,2650,2680
2500 IF S(S(0,0),0)< 3 THEN 2720
2510 GOSUB 6190:GOTO 3980
2520 IF S(S(0,0),0)< 4 THEN 2720
2530 GOSUB 6190:GOTO 3980
2540 IF S(S(0,0),0)< > 3 OR S(S(0,1),0)< > 2 THEN 2720
2550 K(9,A)= 25:GOTO 3980
2560 IF S(1,0)> 0 AND S(2,0)> 0 AND S(3,0)> 0 AND S(4,0)> 0 THEN 2600
2570 IF S(2,0)> 0 AND S(3,0)> 0 AND S(4,0)> 0 AND S(5,0)> 0 THEN 2600
2580 IF S(3,0)> 0 AND S(4,0)> 0 AND S(5,0)> 0 AND S(6,0)> 0 THEN 2600
2590 GOTO 2720
2600 K(10,A)= 30:GOTO 3980
2610 IF S(1,0)AND S(2,0)AND S(3,0)AND S(4,0)AND S(5,0)= 1 THEN 2640
2620 IF S(2,0)AND S(3,0)AND S(4,0)AND S(5,0)AND S(6,0)= 1 THEN 2640
2630 GOTO 2720
2640 K(11,A)= 40:GOTO 3980
2650 IF S(S(0,0),0)< > 5 THEN 2720
2660 IF K(12,A)= 0 THEN K(12,A)= 50:GOTO 3980
2670 K(12,A)= K(12,A)+ 100:GOTO 3980
2680 GOSUB 6190:GOTO 3980
2690 REM
2700 REM  SET PLAYER INVALID
2710 REM
2720 K(I,A)= - 1
2730 GOTO 3980
2740 REM
2750 REM  COMPUTER CHECKS
2760 REM
2770 I= 12
2780 IF S(S(0,0),0)= 5 AND K(12,A)= 0 THEN K(12,A)= 50:GOTO 3980
2790 IF S(S(0,0),0)= 5 AND K(12,A)> 0 THEN K(12,A)= K(12,A)+ 100:GOTO 3980
2800 I= 8
2810 IF S(S(0,0),0)= 4 AND K(8,A)= 0 THEN GOSUB 6190:GOTO 3980
2820 I= 9
2830 IF S(S(0,0),0)= 3 AND S(S(0,1),0)= 2 AND K(9,A)= 0 THEN K(9,A)= 25:GOTO 3980
2840 IF K(11,A)< > 0 THEN 2900
2850 I= 11
2860 IF S(1,0)AND S(2,0)AND S(3,0)AND S(4,0)AND S(5,0)= 1 THEN 2890
2870 IF S(2,0)AND S(3,0)AND S(4,0)AND S(5,0)AND S(6,0)= 1 THEN 2890
2880 GOTO 2900
2890 K(11,A)= 40:GOTO 3980
2900 IF K(10,A)< > 0 THEN 2970
2910 I= 10
2920 IF S(1,0)> 0 AND S(2,0)> 0 AND S(3,0)> 0 AND S(4,0)> 0 THEN 2960
2930 IF S(2,0)> 0 AND S(3,0)> 0 AND S(4,0)> 0 AND S(5,0)> 0 THEN 2960
2940 IF S(3,0)> 0 AND S(4,0)> 0 AND S(5,0)> 0 AND S(6,0)> 0 THEN 2960
2950 GOTO 2970
2960 K(10,A)= 30:GOTO 3980
2970 IF H< 3 THEN 3140
2980 I= 6
2990 IF S(6,0)> 2 AND K(6,A)= 0 THEN K(6,A)= 6* S(6,0):GOTO 3980
3000 I= 5
3010 IF S(5,0)> 2 AND K(5,A)= 0 THEN K(5,A)= 5* S(5,0):GOTO 3980
3020 I= 4
3030 IF S(4,0)> 2 AND K(4,A)= 0 THEN K(4,A)= 4* S(4,0):GOTO 3980
3040 I= 3
3050 IF S(3,0)> 2 AND K(3,A)= 0 THEN K(3,A)= 3* S(3,0):GOTO 3980
3060 I= 7
3070 IF S(S(0,0),0)> 2 AND K(7,A)= 0 THEN GOSUB 6190:GOTO 3980
3080 I= 2
3090 IF S(2,0)> 2 AND K(2,A)= 0 THEN K(2,A)= 2* S(2,0):GOTO 3980
3100 I= 1
3110 IF S(1,0)> 2 AND K(1,A)= 0 THEN K(1,A)= S(1,0):GOTO 3980
3120 I= 13:IF K(13,A)< > 0 THEN 3140
3130 IF C(1)+ C(2)+ C(3)+ C(4)+ C(5)> 19 THEN GOSUB 6190:GOTO 3980
3140 REM
3150 REM  CLEAR DICE NUMBER F(B)
3160 REM  COMPUTER
3170 REM
3180 FOR B= 1 TO 5
3190 F(B)= 0
3200 NEXT B
3210 REM
3220 REM  GET DICE CONTROL
3230 REM  COMPUTER
3240 REM
3250 H= H+ 1:IF H> 3 THEN 3840
3260 I= M(MR):IF I< > 0 THEN 3290
3270 MR= MR+ 1:IF MR> 13 THEN MR= 1
3280 GOTO 3260
3290 IF I= 12 AND K(12,A)> - 1 THEN 3330
3300 IF K(I,A)< > 0 THEN 3270
3310 IF I= 9 THEN 3440
3320 IF I= 10 OR I= 11 THEN 3560
3330 REM
3340 REM  GET DICE 1,2,3,4
3350 REM  COMPUTER
3360 REM
3370 M= 0:J= 1
3380 M= M+ 1:IF M> 4 THEN 3720
3390 K= S(0,M):IF K= 0 THEN 3720
3400 FOR L= 1 TO S(K,0)
3410 F(J)= S(K,L):J= J+ 1
3420 NEXT L
3430 GOTO 3380
3440 REM
3450 REM  GET DICE FH
3460 REM  COMPUTER
3470 REM
3480 M= 0:J= 1
3490 M= M+ 1:IF M> 4 THEN 3720
3500 K= S(0,M):IF K= 0 THEN 3720
3510 IF K> 1 THEN 3490
3520 FOR L= 1 TO S(K,0)
3530 F(J)= S(K,L):J= J+ 1
3540 NEXT L
3550 GOTO 3490
3560 REM
3570 REM  GET DICE LG/SM ST
3580 REM  COMPUTER
3590 REM
3600 M= 0:J= 1
3610 M= M+ 1:IF M> 4 THEN 3680
3620 K= S(0,M):IF K= 0 THEN 3680
3630 IF S(K,0)= 1 THEN 3610
3640 FOR L= 1 TO S(K,0)
3650 F(J)= S(K,L):J= J+ 1
3660 NEXT L
3670 GOTO 3610
3680 IF F(1)< > 0 THEN 3720
3690 L= INT (2* RND (1)+ 1)
3700 F(1)= 5
3710 IF L= 1 THEN F(1)= 1
3720 REM
3730 REM  COMPUTER ROLL AGAIN
3740 REM
3750 FOR B= 1 TO 4
3760 IF F(B)< 1 THEN 3810
3770 C(F(B))= INT (6* RND (1)+ 1)
3780 DIE= C(F(B)):J= F(B)- 1
3790 GOSUB 5250
3800 GOSUB 5530
3810 F(B)= 0
3820 NEXT B
3830 GOTO 2140
3840 REM
3850 REM  COMPUTER MUST SCORE
3860 REM
3870 MR= MR+ 1:IF MR> 13 THEN MR= 1
3880 I= M(MR):IF I= 0 THEN 3870
3890 IF K(I,A)< > 0 THEN 3870
3900 IF I> 6 THEN 3960
3910 GOSUB 6110
3920 IF X= - 1 THEN 3970
3930 IF K(I,A)< > 0 THEN 3870
3940 K(I,A)= S(I,0)* I
3950 IF K(I,A)< > 0 THEN 3980
3960 IF I= 13 AND K(13,A)= 0 THEN GOSUB 6190
3970 IF K(I,A)= 0 THEN K(I,A)= - 1
3980 REM
3990 REM  GET SCOREBOARD TOTALS
4000 REM
4010 FOR J= 14 TO 17
4020 K(J,A)= 0
4030 NEXT J
4040 FOR J= 1 TO 6
4050 IF K(J,A)< 0 THEN 4070
4060 K(15,A)= K(15,A)+ K(J,A)
4070 NEXT J
4080 IF K(15,A)> 62 THEN K(14,A)= 35
4090 FOR J= 7 TO 13
4100 IF K(J,A)< 0 THEN 4120
4110 K(16,A)= K(16,A)+ K(J,A)
4120 NEXT J
4130 K(17,A)= K(14,A)+ K(15,A)+ K(16,A)
4140 REM
4150 REM  PRINT SCORE
4160 REM
4170 GOSUB 2110
4180 COLOR 15,0
4190 FOR J= 1 TO 6
4200 IF K(J,A)< 0 THEN LOCATE J+1,4* (A- 1)+ 15:PRINT "  0";:GOTO 4230
4210 IF K(J,A)< 1 THEN 4230
4220 LOCATE J+1,4* (A- 1)+ 15:PRINT  USING"###";K(J,A);
4230 NEXT J
4240 FOR J= 7 TO 13
4250 IF K(J,A)< 0 THEN LOCATE J+4,4* (A- 1)+ 15:PRINT "  0":GOTO 4280
4260 IF K(J,A)< 1 THEN 4280
4270 LOCATE J+4,4* (A- 1)+ 15:PRINT USING "###";K(J,A)
4280 NEXT J
4290 LOCATE 9,4* (A- 1)+ 15:PRINT USING "###";K(15,A)
4300 LOCATE 19,4* (A- 1)+ 15:PRINT USING "###";K(16,A)
4310 LOCATE 20,4* (A- 1)+ 15:PRINT USING "###";K(14,A)
4320 LOCATE 21,4* (A- 1)+ 15:PRINT USING "###";K(17,A)
4330 COLOR 7,0
4340 IF A* CC< > N THEN 1330
4350 REM
4360 REM  RESET M(I) COMPUTER PRIORITIES
4370 REM
4380 FOR B= 1 TO 13
4390 IF M(B)= 12 THEN 4410
4400 IF M(B)= I THEN M(B)= 0
4410 NEXT B
4420 GOTO 1330
4430 REM
4440 REM   INSTRUCTIONS
4450 REM
4460 PRINT "            Y A H T Z E E "
4470 PRINT "THIS IS THE GAME OF YAHTZEE - "
4480 PRINT "FROM 1 TO 7 PLAYERS MAY PLAY AT THE SAME TIME"
4490 PRINT "WITH EACH PLAYERS CURRENT STATUS SHOWN ON THE"
4500 PRINT "PLAYING BOARD, INCLUDING TOTAL SCORES"
4510 PRINT
4520 PRINT "THE ONLY DIFFERENCE BETWEEN THIS GAME AND THE"
4530 PRINT "POPULAR HOME GAME IS THAT YOU MAY GET MULTIPLE"
4540 PRINT "YAHTZEES HERE ..... THE FIRST YAHTZEE SCORES"
4550 PRINT "50 POINTS, AND EACH ADDITIONAL ONE WILL YIELD"
4560 PRINT "A BONUS OF 100 POINTS (IF THE YAHTZEE IS PUT"
4570 PRINT "INTO THE YAHTZEE BLOCK)..... IN ADDITION YOU"
4580 PRINT "WILL BE GIVEN AN EXTRA TURN AT THE END OF"
4590 PRINT "THE GAME":PRINT :PRINT
4600 PRINT "THE WINNER WILL BE ANNOUNCED AT THE END OF"
4610 PRINT "THE GAME - - BUT I WOULDNT ADVISE ANYONE"
4620 PRINT "TO BE LAST......."
4630 PRINT:PRINT
4640 GOSUB 2090:INPUT "HIT RETURN TO CONTINUE  ";Y$:BEEP
4650 RETURN
4660 RETURN
4670 LOCATE 10,10:PRINT "YATZEE.BAS     VER 3.2"
4680 LOCATE 12,10:PRINT "27 JUN 79"
4690 LOCATE 14,10:PRINT "DEVELOPED BY"
4700 LOCATE 15,13:PRINT "J.L. HELMS    &    M.F. PEZOK"
4710 LOCATE,16,13:PRINT "1009 LEYTE RD / 1321 SAIPAN RD"
4720 LOCATE 17,17:PRINT "CORONADO,  CA.  92118"
4730 LOCATE 18,15:PRINT "(714) 435-6992 / 437-4659"
4740 PRINT CHR$(11)
4750 RETURN
4760 REM
4770 REM   END - SORT WINNER
4780 REM
4790 X= 2:IF N= 1 THEN 4870
4800 FOR J= 1 TO N- 1
4810 IF K(17,J)> K(17,J+ 1)THEN 4850
4820 K= K(17,J):K(17,J)= K(17,J+ 1):K(17,J+ 1)= K
4830 A$= A$(J):A$(J)= A$(J+ 1):A$(J+ 1)= A$
4840 X= 1
4850 NEXT J
4860 ON X GOTO 4760,4870
4870 REM
4880 REM   PRINT WINNERS STANDINGS
4890 REM
4900 RESTORE 5200
4910 FOR J= 1 TO N
4920 LOCATE 25,1:PRINT STRING$(60," ");
4930 IF J> 1 AND J= N THEN RESTORE 5240
4940 LOCATE 25,1:READ A$
4950 PRINT A$;"     ";A$(J);" ";
4960 TT= 500* (N- J+ 1):IF TT< 1500 THEN TT= 1500
4970 FOR T= 1 TO TT:NEXT T
4980 NEXT J
4990 LOCATE 25,1:PRINT STRING$(60," ");
5000 LOCATE 24,1:PRINT "+++   END OF GAME   +++";
5010 FOR T= 1 TO 2000:NEXT T
5020 '
5030 GOSUB 2090:LOCATE 25,1:INPUT "PLAY AGAIN?  Y/N  ";Y$
5040 IF LEFT$ (Y$,1)= "Y"THEN GOSUB 5090:GOTO 1110
5050 IF LEFT$ (Y$,1)= CHR$(27) THEN BEEP:GOTO 5070
5060 IF LEFT$ (Y$,1)< > "N"THEN BEEP:GOTO 5030
5070 CHAIN "MENU",1000
5080 END
5090 REM
5100 REM   CLEAR MATRICES
5110 REM
5120 FOR K= 1 TO 7
5130 FOR J= 1 TO 18
5140 K(J,K)= 0
5150 NEXT J
5160 A$(K)= ""
5170 NEXT K
5180 CLS
5190 RETURN
5200 DATA "+++   THE WINNER   +++"
5210 DATA " SECOND PLACE"," THIRD PLACE "
5220 DATA " FOURTH PLACE "," FIFTH PLACE "
5230 DATA " SIXTH PLACE "
5240 DATA " DEAD LAST "
5250 REM
5260 REM   ERASE DIE
5270 REM
5280 COLOR 0,7:PRINT"";:
5290 LOCATE 4* J+ 1,50:PRINT"       ";
5300 LOCATE 4* J+ 2,50:PRINT"       ";
5310 LOCATE 4* J+ 3,50:PRINT"       ";
5320 COLOR 7,0
5330 RETURN
5340 REM
5350 REM    CHECK IF DONE
5360 REM
5370 X= 0
5380 FOR J= 1 TO N
5390 Y= 2
5400 FOR K= 1 TO 13
5410 IF K(K,J)= 0 THEN Y= 1
5420 NEXT K
5430 K(18,J)= Y
5440 IF Y= 2 THEN X= X+ 1
5450 NEXT J
5460 IF X= > N THEN A= 0
5470 RETURN
5480 REM
5490 REM  COMPUTER PRIORITIES INFO
5500 REM
5510 GOSUB 6780
5520 RETURN
5530 REM
5540 REM   PRINT DIE
5550 REM
5560 COLOR 0,7:LOCATE ,,0
5570 REM
5580 PLAY "L32T200N=TN(DIE);"
5590 ON DIE GOTO 5930,5870,5810,5750,5690,5630
5600 '
5610 '   SIX
5620 '
5630 LOCATE 4*J+1,50:PRINT "";CHR$(32);CHR$(2);CHR$(32);CHR$(2);CHR$(32);CHR$(2);CHR$(32);
5640 LOCATE 4*J+2,50:PRINT CHR$(32);CHR$(32);CHR$(32);CHR$(32);CHR$(32);CHR$(32);CHR$(32);
5650 LOCATE 4*J+3,50:PRINT CHR$(32);CHR$(2);CHR$(32);CHR$(2);CHR$(32);CHR$(2);CHR$(32);:GOTO 5960
5660 '
5670 '   FIVE
5680 '
5690 LOCATE 4*J+1,50:PRINT "";CHR$(32);CHR$(2);CHR$(32);" ";CHR$(32);CHR$(2);" ";
5700 LOCATE 4*J+2,50:PRINT " ";CHR$(32);" ";CHR$(2);" ";CHR$(32);" ";
5710 LOCATE 4*J+3,50:PRINT " ";CHR$(2);" ";CHR$(32);" ";CHR$(2);" ";:GOTO 5960
5720 '
5730 '   FOUR
5740 '
5750 LOCATE 4*J+1,50:PRINT "";" ";CHR$(2);"  ";CHR$(32);CHR$(2);" ";
5760 LOCATE 4*J+2,50:PRINT "   ";CHR$(32);CHR$(32);CHR$(32);
5770 LOCATE 4*J+3,50:PRINT " ";CHR$(2);"  ";CHR$(32);CHR$(2);" ";:GOTO 5960
5780 '
5790 '   THREE
5800 '
5810 LOCATE 4*J+1,50:PRINT "";" ";CHR$(2);"     ";
5820 LOCATE 4*J+2,50:PRINT "   ";CHR$(2);"   ";
5830 LOCATE 4*J+3,50:PRINT "     ";CHR$(2);" ";:GOTO 5960
5840 '
5850 '   TWO
5860 '
5870 LOCATE 4*J+1,50:PRINT "";" ";CHR$(2);"     ";
5880 LOCATE 4*J+2,50:PRINT "       ";
5890 LOCATE 4*J+3,50:PRINT "     ";CHR$(2);" ";:GOTO 5960
5900 '
5910 '   ONE
5920 '
5930 LOCATE 4*J+1,50:PRINT "";"       ";
5940 LOCATE 4*J+2,50:PRINT "   ";CHR$(2);"   ";
5950 LOCATE 4*J+3,50:PRINT "       ";:GOTO 5960
5960 REM   GET OUT
5970 COLOR 7,0
5980 LOCATE 1,1
5990 RETURN
6000 REM
6010 REM  COMPUTER OPTION
6020 REM
6030 CC= 0
6040 LOCATE 25,1
6050 PRINT "DO YOU WISH TO PLAY AGAINST ME?  Y/N  ";:GOSUB 2090
6060 Y$=INKEY$:IF Y$="" THEN 6060 ELSE BEEP
6070 IF Y$= "N"THEN RETURN
6080 IF Y$< > "Y"THEN 6040
6090 CC= 1
6100 RETURN
6110 REM
6120 REM  CHECK FOR ACES-SIXES ANY POSITION
6130 REM
6140 X= - 1
6150 FOR J= 0 TO 4
6160 IF S(0,J)= I THEN X= J
6170 NEXT J
6180 RETURN
6190 REM
6200 REM  TOTAL DICE VALUE
6210 REM
6220 FOR J= 1 TO 5
6230 K(I,A)= K(I,A)+ C(J)
6240 NEXT J
6250 RETURN
6260 REM
6270 REM  MATRIX INFORMATION
6280 REM
6290 REM  C(5)     CURRENT DICE
6300 REM  K(18,7)  SCOREBOARD
6310 REM           COLUMNS 1-13 BOARD NUMBER
6320 REM           COLUMN    14 BONUS UPPER
6330 REM           COLUMN    15 TOTAL UPPER
6340 REM           COLUMN    16 TOTAL LOWER
6350 REM           COLUMN    17 GRAND TOTAL
6360 REM           COLUMN    18 DONE/NOT DONE STATUS
6370 REM           ROW     1- 7 PLAYERS SCORE
6380 REM           ROW        N COMPUTERS SCORE (<7 PLAYERS)
6390 REM
6400 REM  F(5)     DICE NUMBER TO ROLL AGAIN
6410 REM  A$(7)    PLAYERS NAMES
6420 REM  S(6,5)   COMPUTERS DICE LOGIC
6430 REM           COLUMN     0 DICE NUMBER BY QTY SEQUENCE
6440 REM           COLUMN     1 QTY/POSITION FOR ACES
6450 REM           COLUMN     2 QTY/POSITION FOR TWOS
6460 REM           COLUMN     3 QTY/POSITION FOR THREES
6470 REM           COLUMN     4 QTY/POSITION FOR FOURS
6480 REM           COLUMN     5 QTY/POSITION FOR FIVES
6490 REM           COLUMN     6 QTY/POSITION FOR SIXES
6500 REM           ROW        0 QUANTITY OF DICE
6510 REM           ROW     1- 5 POSITION OF DICE IN C(5)
6520 REM
6530 REM  SAMPLE S(Y,X) FOR DICE OF 5,2,4,6,4
6540 REM
6550 REM  Y/X   0  1  2  3  4  5
6560 REM  0     4  6  5  2          IN QTY/VALUE SEQUENCE
6570 REM  1                         NO DIE=1
6580 REM  2     1  2                1 TWO POSITION 2
6590 REM  3                         NO DIE=3
6600 REM  4     2  3  5             2 FOURS POSITIONS 3 AND 5
6610 REM  5     1  1                1 FIVE POSITION 1
6620 REM  6     1  4                1 SIX POSITION 4
6630 REM           +           +
6640 REM  +     +  ++++++++++++++++ SECTION FOR POSITION DATA
6650 REM  +     +------------------ COLUMN INDICATES QTY
6660 REM  +------------------------ INDEX EQUATES TO DIE VALUE
6670 REM
6680 REM  M(13)    PRIORITY NUMBERS FOR MUST SCORE WHERE VALUE
6690 REM           REFERS TO PLAY BOARD NUMBER
6700 REM
6710 REM  TO RUN INTERNAL CHECKS SECTION - ENTER A -1 FOR
6720 REM  PLAYING BOARD NUMBER OR QTY OF DICE TO ROLL
6730 REM  AGAIN - - DATA WILL NOT BE LOST AND SCREEN
6740 REM  WILL BE RESET WITH CURRENT DICE SHOWN - -
6750 REM  PLAYERS/COMPUTERS SCORE WILL NOT SHOW UNTIL
6760 REM  AFTER THEIR TURN
6770 REM
6780 REM  COMPUTER PRIORIRIES
6790 RESTORE 6800
6800 DATA 11,9,12,8,1,2,3,4,5,6,10,7,13
6810 FOR Y= 1 TO 13:READ M(Y):NEXT :RETURN :RETURN
6820 REM player's board
6830 CLS
6840 PRINT"             ╒═══╤═══╤═══╤═══╤═══╤═══╕
6850 PRINT"ACES........1│...│...│...│...│...│...│1"
6860 PRINT"TWOS........2│...│...│...│...│...│...│2"
6870 PRINT"THREES......3│...│...│...│...│...│...│3"
6880 PRINT"FOURS.......4│...│...│...│...│...│...│4"
6890 PRINT"FIVES.......5│...│...│...│...│...│...│5"
6900 PRINT"SIXES.......6│...│...│...│...│...│...│6"
6910 PRINT"             ╞═══╪═══╪═══╪═══╪═══╪═══╡"
6920 PRINT"TOTAL UPPER..│...│...│...│...│...│...│"
6930 PRINT"             ╞═══╪═══╪═══╪═══╪═══╪═══╡"
6940 PRINT"3 OF A KIND.7│...│...│...│...│...│...│7"
6950 PRINT"4 OF A KIND.8│...│...│...│...│...│...│8"
6960 PRINT"FULL HOUSE..9│...│...│...│...│...│...│9"
6970 PRINT"SM STRAIGHT.A│...│...│...│...│...│...│A"
6980 PRINT"LG STRAIGHT.B│...│...│...│...│...│...│B"
6990 PRINT"YATZEE......C│...│...│...│...│...│...│C"
7000 PRINT"CHANCE......D│...│...│...│...│...│...│D"
7010 PRINT"             ╞═══╪═══╪═══╪═══╪═══╪═══╡"
7020 PRINT"TOTAL LOWER..│...│...│...│...│...│...│"
7030 PRINT"TOP BONUS....│...│...│...│...│...│...│"
7040 PRINT"GRAND TOTAL..│...│...│...│...│...│...│"
7050 PRINT"             ╘═══╧═══╧═══╧═══╧═══╧═══╛"
7060 FOR N=1 TO 5:LOCATE N*4-2,46:PRINT N;:NEXT
7070 RETURN
7080 LOCATE 25,1:PRINT STRING$(70," ");:LOCATE 25,1:RETURN
7090 ' KB INPUT AND ESCAPE
7100 KB$="":WHILE KB$="":KB$=INKEY$:WEND
7110 IF KB$=CHR$(27) THEN 5070 ELSE RETURN

COPYOVER.DOC

Several of the games called from the menu program are included on the
IBM DOS disk and must be copied onto this disk for all menu selections
to work.  The batch file COPYOVER.BAT is provided for this purpose.
To use, place DOS disk(1.0 OR 1.1) in drive a: and this game disk in drive b:
If you have a single drive system wait for prompts from the computer.
Now type:

B:COPYOVER

When all files have been copied your disk is ready to use.


FILES001.TXT

Disk No 1
Program Title: GAMES #1
PC-SIG version 1

This disk is one of the original game disks for the IBM PC.  Many of
these games are primitive compared to ones on latter disks, but they
may all be addressed from a single menu.

Usage: Entertainment

System Requirements: IBM PC or close compatible with Color graphics
                     adapter, 1 disk drive, printer, and Dos 1.0 or later

How to Start: Run program "menu" to start.

File Descriptions:

PATTERNS BAS+ Generates random patterns on color monitor
BLACKJCK BAS  Blackjack game on the monochrome display
YAHTZEE  BAS  Yahtzee game on the monochrome display
MENU     BAS  Menu for selecting programs on this disk
DOTS     BAS  Displays dot patterns for display characters
HATDANCE BAS  Plays the mexican hat dance song
KALEID   BAS+ Generates random patterns on the color display
MAXIT    BAS+ Number game
STRINGS  BAS+ Generates random patterns on the color display
WOMBAT   BAS  Generates word problems
CIRCLES  BAS+ Draws random patterns on the color display
PONGPONG BAS  Pong type game
COPYOVER BAT  Copies games from DOS 1.0 or 1.1 disk
COPYOVER DOC  Description of how to use COPYOVER.BAT

PC-SIG
1030D E Duane Avenue
Sunnyvale Ca. 94086
(408) 730-9291
(c) Copyright 1987 PC-SIG


WOMBATS.DOC

          {H} {H}  Wombats! {H} {H}

  A word-problem generating game



by Michael Potts
the Caspar Institute

1 January 1986
{ version 2.0 }


{ press any key to skip the instructions. }

	Wombats was written to help 7 to 11 year-old learners master
word problems and number sentences. Since I expect the program to
engage this audience across as much of their learning spectrum as
possible, vocabulary for the skeletal sentences is at an
appropriate level, precision in capitalization is insisted upon,
and the problems assume a greater mastery of addition and
subtraction than of the two dimensional operations. Wombats
appeals to the audience's love of fantasy and humor, knowing that
instruction by computer can be less than fun.

	In the classroom, Wombats attracts and engages most students
for awhile, but some students willingly become repeat players. I
try to extend to them the same consideration I want from programs
I use for my own work and enjoyment: if a learning program, or
any program that I return to again and again, forces me to review
a lengthy set of credits, instructions, and warnings every time I
start it, I get impatient. I'm here to work, computer, so let's
get down to it!
	In Wombats, impatience is accommodated. Pressing [Return]
twice in rapid succession gets you past the introduction quickly.
(A third [Return] gets you in trouble. Discerning when one may
safely be impatient, and when one should give a full and
thoughtful answer, is, after all, one of the most important
learnings one may accomplish. When Wombats asks what to call you,
it is best to answer.)
	For the patient and curious, Wombats offers instructions:

                   {H} {H}  Wombats! {H} {H}

     This program makes up word problems ...with your
help. The computer - that's me - will ask you for names
of people and things to put in the problems it invents.

     Before we start, you must tell me the hardest
operation you want. For example, if you choose Subtraction,
the problems will include Addition, too. Next, tell me the
Largest number you want to work with. 99 is a good choice,
but 9 is good for your first game, and 500 is very hard.
(Press [Return] only if you want to use standard settings.)
Finally, I'll ask for the names of five favorite things.
I will reject names of persons or things longer than
16 letters, OR that I think are nonsense. When naming
things, write the word for ONE thing, or I will make up
problems about thingSS! You can press Return at any time,
and I will choose numbers and things for you.

     Press any key to read more, or [Esc] to play.

	Some people object to personifying the computer by letting
it calls itself "I", humans are, after all, superior to the
products of silicon-based technology, and thus uniquely entitled
to "I" and "me". Theory and in-bred distaste for the pathetic
fallacy aside, children (and almost all other computer users) are
comfortable thinking about computers and other pets as persons of
a possibly limited sort, but persons nonetheless. I want Wombats
to be an enabler, working as a patient, predictable, and
supportive coach to the player, so I endow it with a synthetic
personality in the instructions, which are meant to be read by
the player, not necessarily a teacher.
	Instructions like this, printed on paper, are for scholars
or those of us who prefer to see directions on a non-volatile
medium like paper. The on-screen instructions are a middle
ground, for the timid, curious, or forgetful, and we must
remember our audience.
	The best way to learn to play a game should be, to play it.
This exhortation is hardly needed by younger players, and the
play of the program should be sufficiently self-explanatory to
help them through the first rounds. The challenge for a
programmer is to anticipate all the possible wrong answers - an
instructive exercise which clearly separates theoreticians from
practical teachers who have seen it all! Programs like Wombats,
which have been through years of classroom testing, acquire deep
layers of error trapping to help the neophyte. These elaborations
of the mainstream of the program may take more time to perfect
than the mainstream itself, and will be used only rarely; for
their users, they can make the difference between enjoyable
learning and frustrated rejection.

How Wombats gets         Wombats chooses numbers differently for
problems:            addition and subtraction, the one-
a sidetrip for       dimensional operations, and multiplication
programmers          and division, the two-dimensional. For the                        former, any number up to and including the
                     maximum allowed may appear in the top of the
                     problem. Because we have identified the
                     audience for this program to be children who
                     have mastered the one-dimensional operations,
                     and are mastering the two-dimensional, the
                     maximum number to appear in multiplication
                     and division problems, including the result,
                     will be the specified Largest number; the
                     operands will be less than or equal to the
                     square root of the largest number. If, for
                     example, we had allowed 99 as our largest
                     number, the program might pose the problem
                     99 + 99 = ? but would never ask for more than
                     9 * 9 = ? or 81 / 9 = ? .

                   {H} {H}  Wombats! {H} {H}

 Problem control:

hardest Operation:

     1=Add  2=Subtract  3=Multiply  4=Divide

                 your choice ? 4

         Largest number in any problem ? 99

              5 favorite objects:

                    1 :>wombat
                    2 :>plum blossom
                    3 :>backhoe
                    4 :>eggplant
                    5 :>teddy bear

What do I call you?  >Damiana

	If a player is ready to attempt problems of standard
difficulty - all operations, with numbers as large as 99 - and
will accept the computer's inventory of favorite objects, she may
press [Return] when asked to choose the hardest Operation, and
the entries will be made by the computer, and the player will be
asked for an appellation. Experience shows that children will
frequently "fool" the computer by offering a pseudonym. The
persistance of the computer in calling them anything they choose
is strangely delightful, and a clue to the success of Wombats.
	As soon as these parameters are completed, the play begins.

Playing WOMBATS!

     The program makes up simple word problems about the
names, things, and numbers you give it as you play. Each
problem consists of two sentences which tell you what to do
with the numbers to get the right answer. Some are tricky!
All you have to do is enter the right answer - that means
Press the numeral keys that make the number, and then
press the Enter key. (The Return key works, too.) Good
players like to press the NumLock key, and use the keypad
for speed. You get credit for being RIGHT, not for
being FAST. Enjoy yourself, and PAY ATTENTION.

     If you make a mistake, you can accept help by pressing
Y or can try a problem again by pressing N - but you only
get 3 tries. It is okay to use paper and pencil, but try
not to count on your fingers. Help asks you questions that
make the problem easier to understand.

     Good Luck! Press T to read more about Wombats.
             Press the Enter key to play.

The game looks like this:

-------------------------{ 1 }---------------------------

Damiana worked for 49 days building door knobs.

When she finished, she had made only 7.


     How many days does it take Damiana to make 1 door knob?

Damiana correctly responds by pressing the 7 and the [Enter] or
[Return] keys, and the program responds:

That's RIGHT, Damiana.
 1  right answer so far.

----{ press Q to quit - any other key to continue }----
	Wombats also for new names from time to time, offering
players an opportunity for hilarity. The computer, however, is
not too easily fooled, as this sample shows:

I need the name of a person.  >sienna
The names of persons begin with a capital letter.
Remember the SHIFT key. Please try again.
I need the name of a person.  >Sienna
   Is Sienna a he or a she?   >she

	The program counts vowels and rejects names with too few for
its length:

I need the name of a person.  >Snnx
I detect nonsense. I don't think "Snnx" is really
someone's name. Please try again.
I need the name of a person.  >

	Periodically, Wombats also refreshes its object inventory by
asking for something new. This is the opportunity that children
twist to their own ends, entering progressively more outrageous
objects, people, and agencies, in an effort to "test" the
tolerance of the computer:

I need the name of an object.>lawn mower

	In due course, a problem about lawn mowers is proposed:

-------------------------{ 4 }---------------------------

Last Monday, Damiana invented a machine that makes lawn
mowers. That day, she made 63 lawn mowers.

The next day, she made 32 more.


    How many lawn mowers does she have now?

	Suppose Damiana subtracts instead of adding, and answers 31.
The program replies,

          -< wrong answer >- Do you want HELP ?

An affirmative answer - press the Y - starts the help dialogue:

  ...Okay:                     =============[HELP]=======

   What number do you start with? 63

   What is the second number? 32

   What do you do with these numbers: add, subtract,
                                    multiply, or divide?
Subtract
     No. To do this problem, you need to add.
The clue: she made 63, then makes 32 more.
Shouldn't you add?y

  So do this problem:    63 + 32 = ?

	In this example, Damiana repeated her error, and the
computer showed her the clue that shows this to be an addition
problem.

	If the player cannot find the numbers to manipulate, the
program retypes the sentences one at a time. In this example, the
player perseverates in the wrong answer; equally stubbornly, the
computer repeats the first part over again.

  ...Okay:                     =============[HELP]=======

   What number do you start with? 6
     No. Read the first part again carefully:
You and Sienna catch 12 ballet slippers in ballet slipper
traps in the forest.

   What number do you start with? 6
     No. Read the first part again carefully:
You and Sienna catch 12 ballet slippers in ballet slipper
traps in the forest.

   What number do you start with? 12

   What is the second number? 12
     No. Read the second part again carefully:
You dug 6 traps.

   What is the second number? 6

   What do you do with these numbers: add, subtract,
                                    multiply, or divide?
Add
     No. To do this problem, you need to divide.
You need to know how many each trap caught (as an average),
so you divide 12 into 6 groups. Right?y

  So do this problem:    12 / 6 = 3

   You need to work on your division FACTS.
The correct answer is 2 .

	In this example, the player made every mistake available
(and some of them twice). We might be tempted to suspect the
player of making mistakes just to explore the program. This is a
rarified and valuable kind of learning, to be encouraged.
Another problem reveals a built-in error - it could be called a
bug, but I prefer to call it a feature:

-------------------------{ 10 }---------------------------

This morning, Rochelle looked in her pocket and found 42
butterflys.

Later, she won 33 more in a bet with Damiana. (That's you.)


    How many butterflys does she have now?

	English pluralizes irregularly, but computers are good at
identical repetition. The simple algorithm for pluralizing is,
add an "s" to the singular; the exceptions are numerous, and
frequently curious. If you can devise an algorithm for correcting
the irregularities, you are invited to "patch" the program. In
the meantime, I rationalize this feature by noting that children
usually spot the computer's error immediately, and are delighted
that it should make such a stupid mistake. The player's mastery
of the concept of irregular pluralization is reinforced. There is
danger, of course, for students who have not mastered the
concept, and accept everything the computer says as gospel.
Garbage In, Gospel Out!

	After ten problems (or when the player accepts the
computer's invitation to Quit) an inventory of the last set of
problems is displayed:

Inventory coming!

++++++++++++++++++++++++++++++++++++++++++++++++++++++
rocking chairs :        40 - 2 = 38
lawn mowers :           1 * 1 = 1
umbrellas :             43 - 40 = 3
red flowers :           34 - 20 = 14
red flowers :           31 - 25 = 6               <2111
wombats :               1 * 3 = 3
ballet slippers :       12 / 6 = 2                <4112
mongooses :             1 * 4 = 4
wing nuts :             23 + 0 = 23
butterflys :            42 + 33 = 75

Damiana, you have gotten 8 right, 2 wrong,
   for a score of 80%.

If the player is doing well, the computer adds a "WELL DONE" (for
better than 90% correct) and even "Very WELL DONE" (for better
than 95%.) For every problem where Help was accepted and mistakes
were made in deciphering the problem, a diagnostic code - the
last column of four digit numbers - is included.Teacher features

     Wombats keeps track of errors made during play, and
prints a diagnostic code with the problems missed. You can
find an explanation of the codes, and recommended remedies
in the book of instructions, TEACHING with an IBM PC.


Diagnostic codes

	The units digit and the tens digit reflect the number of
times the player missed the first and second numbers in the
problem (respectively.) For example, in the lengthy example of
Help given two pages previously, the last two digits of the
diagnostic code would be 12, showing that the player
misunderstood the first number in the problem twice, and the
second number once.
	The hundreds place reflects errors in the operation that the
player proposes to solve the problem: the numeral represents the
incorrect operation proposed. To refer again to the lengthy Help
dialogue two pages back, the player proposes to add when the
problem requires division; the diagnostic code would show a 1 in
the hundreds place for addition, using the same numeration as in
the program's set-up:

     1=Add  2=Subtract  3=Multiply  4=Divide

	The thousands place reflects errors in solving the numeric
problem. Again, to take the example, a mistake is made in
division, and so the diagnostic code will show a 4 in the
thousands place, signifying a division error (since the numeric
codes for operations, as noted above, are used here as well.)

	The diagnostic code for the example (as can be seen in the
sample Inventory on the previous page) is 4112. As we noted in
the example, a diagnostic code like this may show us that the
student is not ready for this kind of work (in which case most
problems will be followed by full diagnostics), or that her
attention was wandering momentarily, or (most likely) that she
was fooling the computer to see how deeply it was prepared to
help.
	When a student's comprehension of concept or operation is
troubled, the diagnostic codes will reflect the trouble. A string
of errors showing a digit in the hundreds place only indicates a
problem with understanding the operation required by word
problems. A string of errors in the thousands place might
indicate a need to polish addition or multiplication facts.
Errors in the less significant digits - the units and tens -
reveals inattention of reading problems.More Teacher Features

     If you have a printer, you can make the game more
interesting by turning the printer switch on - see line 8
and the instructions. Then, whenever an inventory of problems
is ready for display, the player will be asked if a print-out
is desired. Players can also print each problem by pressing
P after entering the correct answer.

	To make changes in the program, you must attack your
computer's BASIC interpreter, at least in a very minor way. The
"switch" that tells the program whether or not a printer is
connected is in line number 8, which looks like this:

	8 PR.SW=0:' printer switch  0 = off   1 = on

As you may remember from the earlier chapter on Controlling
Computers, you may change this line by LISTing it, then moving
the cursor (with the cursor arrows) over the 0, typing a 1, and
pressing [Return]. To make the change permanent, you must
SAVE"WOMBATS onto your disk.

     You may want to change Wombats in a number of ways;
you may even want to take out the wombats (Oh, no!). Please
refer to the instructions for help customizing the program.

	"If a program is finished, it's obsolete." Like Mrs.
Winchester's famous mystery house, a program is alive only so
long as someone is tinkering with it. This fact is acknowledged
at the mainframe level of computing by the expensive presence of
"hackers" who are constantly tweaking and tuning their machine's
capabilities ...one would hope, to the betterment of its
usefulness (although this is not always the case.) Programs that
provide users with adaptability are much more useful, at any
level, than routines which are unalterable; the most basic lesson
computers are here to teach us is the necessity and delight of
adaptability. Locked programs, which for reasons of security or
profit are unalterable and often uncopyable, teach someone else's
lessons, and in many cases, such lessons are exquisite (as we
discussed earlier in the chapter,) but they can also be prey to
inaccuracy, time, and our love for variety.
	Children reflect this in their delight in changing the
objects and persons in the Wombats problems. The teacher who
takes on the role of Program Maintainer, can add to this delight
by changing Wombats's favorite things from time to time. These
are contained in two places. One set are here:

	9000 DATA wombat,rocking chair,tractor,dump truck,umbrella

and the other set in these lines:

2730 OB$="apple":GOTO 2900
2740 OB$="peanut":GOTO 2900
2750 OB$="wing nut":GOTO 2900
2760 OB$="ballet slipper":GOTO 2900
2770 OB$="sharp pencil":GOTO 2900
2780 OB$="red flower":GOTO 2900
2790 OB$="wombat":GOTO 2900
2800 OB$="sea urchin":GOTO 2900
2810 OB$="door knob":GOTO 2900
2820 OB$="doll shoe":GOTO 2900

Changes may be accomplished as described above, but Prudent
Programming Practice requires us to maintain a known-to-be-
working version as well as a version under development. Serious
changes in the program are possible, and certainly desirable; the
serious tinkerer should use lots of common sense in planning and
executing these changes. As we have mentioned before, education
should proceed for all across the widest possible spectrum, and
the teacher-maintainer is certainly included: in learning to
program, and to observe the effects on the player-learners of my
efforts, and continually improving the enhancements, continues an
exciting and time-consuming process, in which adding to my own
knowledge has always been the largest component.

	Teaching the computer's linear language to follow the
strange and wonderful twists of the English language offers an
opportunity to perfect our understanding of both. The linguistic
format of Wombats's problems is,

S1$:	< Person > [ action ] { First number } < Object >[s]

S2$:  < P's Gender > [ action ] { Second number }

where the enclosures denote <data provided by the player>, [data
provided by the program], and {data within ranges specified at
the start.} In the simplest case, a problem that reads like this,

S1$:{Damiana}[ needs something special at school today, so]<
she>[ takes along]{ 6}[ ]<rattlesnake>[s.]

S2$:[On the way to school,]< she>[ sees a hat by the road; under
it]< she>[ finds]{ 13}[ more.]

	The code that puts those sentences together looks like this:

3020 S1$=P1$+" needs something "
3030 S1$=S1$+"special at school today, so "+SX$+" takes along"
3040 S1$=S1$+STR$(N1)+" "+OB$:IF N1<>1 THEN GOSUB 2600
3050 S1$=S1$+".":S2$="On the way to school, "+SX$+" sees a hat by
the "
3060 S2$=S2$+"road; under it "+SX$+" finds"
3070 S2$=S2$+STR$(N2)+" more.":GOTO 4970

A glossary of the symbols in that section:

symbol   what it represents                 example value

S1$      First sentence of problem          [ see   ]
S2$      Second sentence                    [ above ]
         	These two sentences are
         put together by the computer
         using the variables below as
         building blocks.

P1$      First person                       Sienna
SX$      Person's gender pronoun             she
OB$      the Object in question             rattlesnake
         	These are supplied by the
         player as prompted by the
         program.

N1       First number                       6
N2       Second number                      13
         	Randomly chosen by the
         computer within limits set at
         the start of the program.

STR$(N1) a string derived by the             6
         computer consisting of a space
         (or, for a negative number, a
         hyphen) and the number or
         variable in parentheses.


	Each problem also has an associated QUestion, Correct
Answer, and key phrase V$ determining the operation to be used in
solving the problem for use by Help. For this problem, they are
supplied at the start of the addition programs and by the line,

       3010 QU$="does "+P1$:V$=SX$+" takes"+STR$(N1)+", then finds"+STR$(N2)

Subroutines: black boxes we need not understand

	Repetitive and complicated steps are often hidden in
subroutines or at the beginnings and ends of processes. Two such
external routines are used in this code segment.

GOSUB 2600


GOTO 4970



Pluralizer  (a subroutine)
	Adds an "s" to a working string T$

Problem poser (end of program generation)
	Pops the question and gets the answer.
All problem generators end with GOTO 4970
unless they completely rebuild the question,
in which the GOTO 4980
	A rudimentary understanding of BASIC is needed if you want
to decode, change, or augment the addition (starting at line
3000), subtraction (from line 4000), multiplication (from line
5000), or division (line 6000.) As complex and lengthy as it is,
Wombats uses less than a third of the IBM's Basic workspace, and
so there is plenty of room for growth!

	Among the division problems are two trick questions, wherein
the trick is that the second number is one less than the divisor
because an additional share is implicitly included in the
problem:

Sienna found a bag with 12 rocking chairs in it.
After school, she shared them with her 3 sisters.

    How many rocking chairs does each one have now? 4

          -< wrong answer >- Do you want HELP ?

	Since these are four to share the windfall - Sienna and her
three sisters - the correct answer is 3.
	The code that starts the question, calculates the normal
Correct Answer, and randomly chooses the problem is contained in
line 6000 and 6010. This problem results only when the N
calculated in line 6000 is 1 and the program is sent to line
6020, where the problem itself is generated. Note the way an
extra share of objects is added and the Correct Answer
recalculated in line 6020.

6000 QU$="does each one":CA=N1/N2:N=5*RND(1)+1:'                 division
6010 ON N GOTO 6020,6090,6140,6200,6240
6020 N1=N1+CA:CA=N1/(N2+1):S1$=P1$+" found a bag with"+STR$(N1)+" "+OB$
6030 IF N1<>1 THEN GOSUB 2600
6040 S1$=S1$+" in it.":S2$="After school, "+SX$+" shared them with "+PS$
6050 S2$=S2$+CHR$(29)+STR$(N2)+" sister":IF N2<>1 THEN GOSUB 2610
6060 V$="each person gets":S2$=S2$+".":N2=N2+1:GOTO 4970


	When adding new problems, you need not wait patiently while
the computer comes up with the right combination - which might
take 20 or more problems as the program stands now. Because BASIC
is superbly responsive to minor changes, you can change the line
that chooses the next problem's operation from

500 OP=INT(NL*RND(1)+1):'                     SUBROUTINES:    get operation

		to

500 OP=4:'INT(NL*RND(1)+1):'                  SUBROUTINES:    get operation

for example, to test a new division problem. The addition of the
colon and apostrophe tell the interpreter to ignore the rest of
the line. With this change in place, only division problems will
result. To include a new problem, the first of the operation's
lines must be changed as well. To add a sixth division problem,
line 6000 would changed to

6000 QU$="does each one":CA=N1/N2:N=6*RND(1)+1:'                 division

but to test the problem, we might wish first to change the line to

6000 QU$="does each one":CA=N1/N2:N=6:'*RND(1)+1:'               division

so that only the sixth problem will appear. When you are
confident that the new problem is correct and literate, remember
to take the comment marks (the :') out of the program. Otherwise,
the players may complain that they are getting only one problem.

Credit where credit is due:

     Send us $5 and your thoughts: the Caspar Institute,
Box 88 / Caspar  CA  95420. Please make copies of this
program, but DO NOT remove the sharing information.

	By all means, if you correct any bugs or add to the program
significantly, take credit yourself. The credits are in the first
lines of the program, but there is plenty of room for more
credits; use lines 11 - 19. A credit line might look like,

     11 ' additional problems added by R. Elkan  10 Jan 86

3897 words
11 January 1986
revised 10 June 1986


Directory of PC-SIG Library Disk #0001

 Volume in drive A has no label
 Directory of A:\

ASK      COM       512  10-03-85   3:15p
BLACKJCK BAS      8320   1-01-80
CASPAR   BAT      1681   6-11-86   1:51p
CASPAR   HLP      4376   6-11-86   1:53p
CASPAR0  HLP      1177   6-11-86   1:29p
CASPAR1  HLP      1359   6-11-86   1:48p
CASPAR2  HLP      1139   6-11-86   2:13p
CASPAR3  HLP       704   6-11-86   1:53p
CIRCLES  BAS      1024   1-01-80
COPYOVER BAT       198   3-26-83   2:01p
COPYOVER DOC       450   3-26-83   2:15p
DOTS     BAS      1408   2-02-82
FILES001 TXT      1299   5-28-87   5:00p
HATDANCE BAS      1664   1-01-80
KALEID   BAS      2560   3-26-82
MAXIT    BAS      4608   3-26-82
MENU     BAS      4096  12-24-82   1:04p
OTHELLO  BAS      6912   1-01-80
PATTERNS BAS      4096   9-08-82  12:50p
PONGPONG BAS      4992   1-01-80
SAMPLES  BAS       128   3-26-83   2:35p
STRINGS  BAS       512   3-26-82
WOMBATS  BAS     19712   6-17-86   9:34a
WOMBATS  DOC     26880   6-10-86   4:24p
WOMBATS  WP      25933   6-10-86   3:50p
YAHTZEE  BAS     15104   3-26-82
       26 file(s)     140844 bytes
                       14336 bytes free