option qBasic
  ' by Rick3137   http://rb23.yolasite.com
  p2 = 6.28318530
  Ang1 = p2/9 : Ang = 0 : x = 0.0 : y = 0.0
   count = 0 : Time1 = 0 : Time2 = 0


declare function MoveSteps ( distance )
declare function RotateLeft(angle)
declare function SetColor(clr)
declare function SetColor2(clr)
declare function Fractal1(  )
declare function Fractal2(  )
declare function Fractal3(  )
declare function Fractal4(  )
declare function Fractal5(  )
declare function Fractal6(  )
declare function Fractal7(  )
declare function Fractal8(  )
autoback(-2)
screenswap
setdisplay( 1200,700,32,1)
ink( rgb(20,40,60 ))
cls
ink( rgb(245,200,255 ))
Ang1 = p2/3  :  y = 650 : x = 400.0
Time1 = ticks()
 Fractal1 ()
Time2= ticks()
screenswap
ink( rgb(255,255,255 ))
locate (1,1):prints( Time2 - Time1 )
screenswap
waitkey
end
function Fractal1( )
        cnt = 0
        Distance = 400
   while cnt < 5
           SetColor2(1)
           MoveSteps( Distance )
           RotateLeft( p2/5 )
     cnt = cnt + 1
     Fractal2( )
   wend
end function
function Fractal2( )
        cnt = 0
        Distance = 200
   while cnt < 5
           SetColor2(2)
           MoveSteps( Distance )
           RotateLeft( p2/5 )
     cnt = cnt + 1
     Fractal3( )
   wend
end function
function Fractal3( )
        cnt = 0
        Distance = 100
   while cnt < 5
           SetColor2(3)
           MoveSteps( Distance )
           RotateLeft( p2/5 )
     cnt = cnt + 1
     Fractal4()
   wend
end function
function Fractal4( )
        cnt = 0
        Distance = 100
  SetColor2(count)
   while cnt < 3
           MoveSteps( Distance )
           RotateLeft( p2/3 )
     cnt = cnt + 1
     Fractal5( )
   wend
end function
function Fractal5( )
        cnt = 0
        Distance = 40
  SetColor2(count)
   while cnt < 3
           MoveSteps( Distance )
           RotateLeft( p2/3 )
     cnt = cnt + 1
     Fractal6( )
   wend
end function
function Fractal6( )
        cnt = 0
        Distance = 50
  SetColor2(count)
   while cnt < 3
           MoveSteps( Distance )
           RotateLeft( p2/3 )
     cnt = cnt + 1
     Fractal7( )
   wend
   count = count + 1
   if count > 7 then
     count = 1
  end if
end function
function Fractal7( )
        cnt = 0
        Distance = 25
      while cnt < 3
           MoveSteps( Distance )
           RotateLeft( p2/3 )
     cnt = cnt + 1
      Fractal8( )
   wend
end function
function Fractal8( )
        cnt = 0
        Distance = 12
             while cnt < 6
              MoveSteps( Distance )
              RotateLeft( p2/3 )
        cnt = cnt + 1
          wend
end function
  function SetColor2(clr)
         if clr = 0 then
        ink( rgb(200,200,255 ))
     end if
        if clr = 1 then
        ink( rgb(255,255,255 ))
     end if
      if clr = 2 then
        ink( rgb(0,0,255 ))
     end if
      if clr = 3 then
        ink( rgb(255,0,0 ))
     end if
      if clr = 4 then
        ink( rgb(255,0,0 ))
     end if
      if clr = 5 then
        ink( rgb(255,0,255 ))
     end if
      if clr = 6 then
        ink( rgb(255,100,255 ))
     end if
      if clr = 7 then
        ink( rgb(255,0,255 ))
     end if
 end function
 function RotateLeft( angle)
      ' Angles are in Radians
   ' p2 = 2 * Pi
      Ang = Ang + angle
      if Ang > p2 then
       Ang = Ang - p2
   end if
 end function
 function MoveSteps ( distance )
        dx = cos(Ang) * distance
        dy = sin(Ang) * distance
        x2 = x + dx
        y2 = y - dy
        line( x,y,x2,y2)
        x = x2 : y = y2
 end function
end


 

 
Make a Free Website with Yola.