home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
RBBS in a Box Volume 1 #3.1
/
RBBSIABOX31.cdr
/
fwrd
/
fractal.bas
< prev
next >
Wrap
BASIC Source File
|
1985-10-09
|
1KB
|
50 lines
5 REM Fractal program from Byte Magazine Sept. 1984 by Greg Turk
6 REM converted from AppleSoft Basic to IBM basic by Ed Schmeckpeper
10 CX = 160!: CY = 96! ' screen parameters width/2, height/2
20 X= .50001: Y=0!
100 GOSUB 5000
110 SCREEN 1,1:COLOR 0,15' convert color command from applesoft
120 FOR I= 1 TO 10:GOSUB 4000:NEXT
140 GOSUB 6000
160 GOSUB 4000
170 A$=INKEY$:IF A$<>"" THEN 10000
180 GOTO 140
999 END
1000 REM square root of x,y
1005 T = Y
1010 S = SQR((X*X)+(Y*Y))
1020 Y = SQR(ABS((-X+S)/2))
1030 X = SQR((X+S)/2)
1040 IF T< 0 THEN X= -X
1050 RETURN
2000 REM four over l
2010 S =(LX*LX)+ (LY*LY)
2020 LX = 4 * LX/S
2030 LY = -4 *LY/S
2040 RETURN
3000 REM x,y times l
3010 TX = X: TY = Y
3020 X = (TX*LX)-(TY*LY)
3030 Y = (TX*LY)+(TY*LX)
3040 RETURN
4000 REM function of x,y
4010 GOSUB 3000
4020 X=1-X
4030 GOSUB 1000
4040 IF RND(1) <.5 THEN X=-X:Y=-Y
4050 X=1-X
4060 X=X/2:Y=Y/2
4070 RETURN
5000 REM get values
5010 KEY OFF:CLS
5020 INPUT "What is LAMBDA (LX,LY) ";LX,LY
5030 GOSUB 2000
5040 INPUT "What is SCALE FACTOR ";SC
5050 SC= 2*CX/SC
5055 CLS
5060 RETURN
6000 REM plot x,y
6010 PSET ((SC*(X-.5)+CX),(CY-(SC*Y))),1
6020 RETURN
10000 END