rem This program written by Rick3137
rem http://rb23.yolasite.com/
visible:
pendown = 0 ; PenX# = 0.0 ; PenY# = 0.0 ; Angle# = 0.0 ; Angle2# = 0.0 ; x1# =0.0 ; y1# = 0.0
x2# = 0.0 ; y2# = 0.0 ; dx# = 0.0 ; dy# = 0.0 ; d# = 0.0 ; cnt2 = 0 ; red =0 ; green = 0 ; blue = 0 ; key = 0
stx# = 0.0 ; sty# = 0.0
hidden:
cnt = 0 ;
rem Starts Program
a = 0 ; set redraw off
cnt = 0
r = 100
g = 100
b =255
set window 0, 0, 1200, 700, true, 1
set color 25, 25, 60
cls
set color 0, 0, 0
set color 100,100,255
pendown = 1
rem a = Test( a,b)
cnt = 0
stx# = -85.0
sty# = 20.0
d# = 80.0
while (cnt < 10)
PenX# = stx#
PenY# = sty#
Angle# = 90.0
a = Fractal(d#,4)
a = RotateRight(120.0)
a = Fractal(d#,4)
a = RotateRight(120.0)
a = Fractal(d#,4)
set color r,g,b
g = g + 10
r = r + 5
cnt = cnt + 1
stx# = stx# - 15.0
sty# = sty# + 10.0
Angle# = 90.0
d# = d# + 10.0
wend
wln " Hit any key to end "
redraw
pendown = 0
wait keydown
rem ************************** END PROGRAM *************************
function SetColor2(n)
red = n * 10
green = n * 12
blue = n * 14
set color red,green,blue
endfunc
function ChangeColor(n)
blue = blue + n
if blue > 255 then
blue = 0
green = green + 1
endif
if green > 255 then
green = 0
red = red + 1
endif
if red > 255 then green = 0
red = 0
blue =0
endif
set color red,green,blue
endfunc
function GotoXY( x#,y# )
PenX# = x#
PenY# = y#
endfunc
function RotateRight(n#)
Angle# = Angle# + n#
if Angle# > 360.0 then Angle# = Angle# - 360.0
if Angle# = 360.0 then Angle# = 0.0
endfunc
function RotateLeft(n#)
if Angle# = n#
Angle# = 0.0
n# = 0.0
endif
if Angle# > n#
Angle# = Angle# - n#
else
Angle# = n# - Angle#
Angle# = 360.0 - Angle#
endif
endfunc
rem math degrees = 450 - compass degrees
function GetAngle# (n#) ; rem input compass degrees, output math degrees
n# = 450.0 - n#
if n# = 450.0 then n# = 90.0
if n# > 450.0 then n# = n# - 360.0
return n#
endfunc
function MoveSteps ( t# )
lx = 0 ; ly = 0 ; lx2 = 0 ; ly2 = 0
x1# = 500.0 + PenX#
y1# = 300.0 - PenY#
Angle2# = GetAngle# ( Angle# )
dx# = cos (Angle2#)
dy# = sin (Angle2#)
x2# = x1# + ( dx# * t# )
y2# = y1# - (dy# * t# )
lx = int(x1#) ; lx2 = int(x2#) ; ly = int(y1#) ; ly2 = int(y2#)
if pendown = 1 then draw line lx,ly,lx2,ly2
PenX# = PenX# + (dx# * t#)
PenY# = PenY# + (dy# * t#)
return lx
endfunc
function Test( a,b)
A$ = str$(a)
B$ = str$(b)
a = MoveSteps ( 200.0 )
a = RotateLeft(90.0)
a = MoveSteps (200.0)
a = RotateLeft(90.0)
a = MoveSteps (200.0)
a = RotateLeft(90.0)
a = MoveSteps (200.0)
a = RotateLeft(90.0)
a = MoveSteps (200.0)
a = RotateLeft(90.0)
a = MoveSteps (200.0)
wln 50,100,str$(Angle# )
wln 50,120,str$(Angle2#)
endfunc
function Fractal ( Distance#, Lp )
if Lp > 0
Lp = Lp - 1
Distance# = Distance# / 3.0
a = Fractal (Distance#, Lp)
a = RotateLeft(60.0)
a = Fractal (Distance#, Lp)
a = RotateRight(120.0)
a = Fractal (Distance#, Lp)
a = RotateLeft(60.0)
a = Fractal (Distance#, Lp)
else
a = MoveSteps (3.0 * Distance#)
endif
endfunc