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) < .25 THEN CH$=CH$(4* RND (1)+1):GOSUB 1600
1205 IF RND(1) < .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)= .5 THEN CC= 1
1400 IF RND (1)> .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)< .25 THEN CC= INT (8* RND (1)):GOSUB 1720:PLOT 6,CCOR MA
1540 IF RND (1)< .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