trb@drutx.UUCP (BuckleyTR) (02/06/85)
Here are two graphical Microsoft Basic programs I got off a bulletin board a while back. There are two programs here, and this isn't in shar format, so you'll have to separate them out yourselves! Tom Buckley AT&T Information Systems (303) 538-3442 ihnp4!drutx!trb ---------------------------- Cut Here ---------------------------------- 1000 ' MACART - KINETIC STRING ART FOR THE MACINTOSH - VERSION 1.1 1010 ' 1020 ' BY STEVEN J. MEDWIN [74146,3303] 4/25/84 1030 ' 1040 ' 1050 ' DIRECTIONS 1060 ' 1070 ' THIS PROGRAM DISPLAYS A SERIES OF LINES IN AN EVER CHANGING 1080 ' PATTERN. UP TO 10 GROUPS OF LINES MAY BE ANIMATED AT ONCE. THESE 1090 ' GROUPS MAY BE SEPARATE OR OVERLAPPING. TO START, SIMPLY ENTER A SERIES 1100 ' OF RECTANGLES BY CLICKING AND DRAGGING. A SERIES OF LINES WILL BE CONT 1110 ' IN THE SPACE DEFINED BY EACH RECTANGLE. PRESS ANY KEY TO START THE 1120 ' ANIMATION. THE SEPARATE RECTANGLES WILL BE REPLACED BY A BORDER 1130 ' ENCLOSING ALL THE SPACES. IF THE MOUSE BUTTON IS PRESSED, THEN THE 1140 ' NUMBER OF LINES IN EACH GROUP WILL CHANGE. IF ANY KEY IS PRESSED, THEN 1150 ' NEW RECTANGLES MAY BE ENTERED. 1160 ' EXPERIMENT! DIFFERENT EFFECTS CAN BE ACHIEVED BY DESIGNING THE INITIAL 1170 ' SPACES DIFFERENTLY. THE LOWER THE NUMBER OF GROUPS USED, THE FASTER 1180 ' THE ANIMATION. 1190 ' 1200 ' INITIALIZATIONS 1210 ' 1220 DEFINT A-Z 1230 NB = 10 ' MAXIMUM NUMBER OF GROUPS 1240 MAX = 100 ' MAXIMUM NUMBER OF LINES PER GROUP 1250 OPTION BASE 1 1260 ' ARRAYS OF END POINTS 1270 DIM A1(NB,MAX),B1(NB,MAX),A2(NB,MAX),B2(NB,MAX) 1280 ' COORDINATES FOR SPACES FOR GROUPS 1290 DIM NX(NB),NY(NB),MX(NB),MY(NB) 1300 ' CURRENT END POINTS 1310 DIM X1(NB),X2(NB),Y1(NB),Y2(NB),C(NB) 1320 ' SOME CONSTANTS 1330 WHITE = 30: BLACK = 33: TRUE = 1 1340 K = 8 ' CONSTANT USED IN LINE MOVEMENT 1350 CO = 10 ' CONSTANT USED BY COUNTER 1360 CLS: RANDOMIZE TIMER 1370 ' 1380 ' INPUT THE SIZE FOR EACH GROUP 1390 ' 1400 GOSUB 1930 1410 ' 1420 ' SET INITIAL LINE POSITIONS AND NUMBER OF LINES PER GROUP 1430 ' 1440 CLS 1450 PRINT " INITIALIZING...." 1460 ' DETERMINE NUMBER OF LINES PER GROUP BASED ON NUMBER OF GROUPS 1470 N = ((MAX-1)/NB)*RND+1 1480 ' 1490 FOR I=1 TO NB 1500 X1(I) = (MX(I)-NX(I))*RND+NX(I) 1510 X2(I) = (MX(I)-NX(I))*RND+NX(I) 1520 Y1(I) = (MY(I)-NY(I))*RND+NY(I) 1530 Y2(I) = (MY(I)-NY(I))*RND+NY(I) 1540 C(I) = 0 1550 FOR J=1 TO N 1560 A1(I,J) = 0: B1(I,J) = 0: A2(I,J) = 0: B2(I,J) = 0 1570 NEXT J 1580 NEXT I 1590 ' 1600 ' START ANIMATION 1610 ' 1620 CLS: CALL PENNORMAL 1630 GOSUB 2200 ' DRAW BORDER 1640 CALL OBSCURECURSOR 1650 ' 1660 PRINT " CLICK TO CHANGE THE NUMBER OF LINES PER GROUP [";N;"]." 1670 PRINT " PRESS ANY KEY TO CHANGE THE NUMBER OF GROUPS [";NB;"]." 1680 TEMP = MOUSE(0) ' RESET MOUSE 1690 WHILE TRUE ' LOOP FOREVER 1700 FOR AA=1 TO N 1710 IF MOUSE(0)<>0 THEN GOTO 1420 1720 IF INKEY$<>"" THEN RUN 1730 FOR I=1 TO NB 1740 WHILE (C(I)=0) 1750 DA(I)=INT(10*RND)-K: DB(I)=INT(10*RND)-K 1760 DC(I)=INT(10*RND)-K: DD(I)=INT(10*RND)-K 1770 C(I)=CO*(1+INT(11*RND)) 1780 WEND 1790 PV=X1(I)+DA(I): IF PV> NX(I) AND PV < MX(I) THEN X1(I)= PV ELSE DA(I) = -DA(I) 1800 PV=Y1(I)+DB(I): IF PV> NY(I) AND PV < MY(I) THEN Y1(I)= PV ELSE DB(I) = -DB(I) 1810 PV=X2(I)+DC(I): IF PV> NX(I) AND PV < MX(I) THEN X2(I)= PV ELSE DC(I) = -DC(I) 1820 PV=Y2(I)+DD(I): IF PV> NY(I) AND PV < MY(I) THEN Y2(I)= PV ELSE DD(I) = -DD(I) 1830 LINE (A1(I,AA),B1(I,AA))-(A2(I,AA),B2(I,AA)),WHITE 1840 LINE (X1(I),Y1(I))-(X2(I),Y2(I)),BLACK 1850 A1(I,AA)=X1(I): B1(I,AA)=Y1(I) 1860 A2(I,AA)=X2(I): B2(I,AA)=Y2(I): C(I)=C(I)-1 1870 NEXT I,AA 1880 WEND 1890 ' 1900 END 1910 ' 1920 ' 1930 ' SUBROUTINE TO INPUT THE SIZE FOR EACH GROUP 1940 ' 1950 CALL PENMODE(10) 1960 PRINT " CLICK AND DRAG TO SET SPACE FOR EACH GROUP. UP TO 10 GROUPS ALLOWED." 1970 PRINT " PRESS ANY KEY TO START THE ANIMATION." 1980 FOR I=1 TO NB 1990 ' WAIT FOR INPUT 2000 IF INKEY$<>"" AND I>1 THEN NB = I-1: RETURN 2010 IF MOUSE(0) = 0 THEN 2000 2020 ' CLICK AND DRAW RECTANGLE TO SIZE SPACE 2030 WHILE MOUSE(0)<0 2040 LEFT = MOUSE(3): TOP = MOUSE(4) 2050 RIGHT = MOUSE(1): BOTTOM = MOUSE(2) 2060 LINE(LEFT,TOP)-(RIGHT,BOTTOM),BLACK,B 2070 FOR X=1 TO 70: NEXT X ' DELAY FOR ANIMATION 2080 LINE(LEFT,TOP)-(RIGHT,BOTTOM),WHITE,B 2090 WEND 2100 ' HAVE SIZE, NOW SET VARIABLES 2110 NX(I) = MOUSE(3): NY(I) = MOUSE(4) 2120 MX(I) = MOUSE(5): MY(I) = MOUSE(6) 2130 ' MAKE SURE NX,NY ARE SMALLER THAN MX,MY 2140 IF MX(I)<NX(I) THEN SWAP MX(I),NX(I) 2150 IF MY(I)<NY(I) THEN SWAP MY(I),NY(I) 2160 LINE(NX(I),NY(I))-(MX(I),MY(I)),BLACK,B 2170 NEXT I 2180 RETURN 2190 ' 2200 ' SUBROUTINE TO DRAW BORDER 2210 ' 2220 LEFT = 500: RIGHT = 0: TOP = 290: BOTTOM = 0 2230 ' FIND THE RECTANGLE THAT ENCLOSES ALL GROUPS 2240 FOR I=1 TO NB 2250 IF NX(I)<LEFT THEN LEFT=NX(I) 2260 IF NY(I)<TOP THEN TOP=NY(I) 2270 IF MX(I)>RIGHT THEN RIGHT=MX(I) 2280 IF MY(I)>BOTTOM THEN BOTTOM = MY(I) 2290 NEXT I 2300 ' 2310 ' DRAW BORDER 2320 LINE(LEFT,TOP)-(RIGHT,BOTTOM),BLACK,B 2330 LINE(LEFT-1,TOP-1)-(RIGHT+1,BOTTOM+1),BLACK,B 2340 LINE(LEFT-3,TOP-3)-(RIGHT+3,BOTTOM+3),BLACK,B 2350 RETURN 2360 ' -------------------------- 2nd program -------------------------- 10 REM LIVING ART 20 REM BY PAUL EDL 30 REM WRITTEN APRIL 26,1984 40 DEFINT A-Z:CALL HIDECURSOR 50 DIM X1(50),Y1(50),X2(50),Y2(50) 60 XMAX=489 70 YMAX=278 80 T=TIMER/100-INT(TIMER/100) 90 RANDOMIZE(T*63.87775#) 100 X1=INT(RND(1)*200) 110 Y1=INT(RND(1)*200) 120 X2=INT(RND(1)*200) 130 Y2=INT(RND(1)*200) 140 FOR A=0 TO 49 150 X1(A)=0 160 Y1(A)=0 170 X2(A)=0 180 Y2(A)=0 190 NEXT A 200 CLS 210 SX1=2*SGN(RND(1)*5-2) 220 IF SX1=0 THEN 210 230 SY1=2*SGN(RND(1)*5-2) 240 IF SY1=0 THEN 230 250 SX2=2*SGN(RND(1)*5-2) 260 IF SX2=0 THEN 250 270 SY2=2*SGN(RND(1)*5-2) 280 IF SY2=0 THEN 270 290 A=0 300 REM program loops here 310 LINE(X1(A),Y1(A))-(X2(A),Y2(A)),30 320 X1=X1+SX1:Y1=Y1+SY1 330 X2=X2+SX2:Y2=Y2+SY2 340 IF X1>XMAX THEN X1=XMAX:SX1=-SX1 350 IF Y1>YMAX THEN Y1=YMAX:SY1=-SY1 360 IF X2>XMAX-1 THEN X2=XMAX-1:SX2=-SX2 370 IF Y2>YMAX THEN Y2=YMAX:SY2=-SY2 380 IF X1<0 THEN X1=0:SX1=-SX1 390 IF Y1<0 THEN Y1=0:SY1=-SY1 400 IF X2<0 THEN X2=0:SX2=-SX2 410 IF Y2<0 THEN Y2=0:SY2=-SY2 420 LINE(X1,Y1)-(X2,Y2),33 430 X1(A)=X1:Y1(A)=Y1:X2(A)=X2:Y2(A)=Y2 440 A=A+1 450 IF A>49 THEN A=0 460 GOTO 300