option qBasic

  p2 = 6.28318530
  Ang1 = p2/5 : Ang = 0 : x = 400.0 : y = 400.0
  clr = 1 : count = 1 : Time1 = 0 : Time2 = 0

declare function Fractal( depth , distance )
declare function MoveSteps ( distance )
declare function RotateLeft()
declare function SetColor()

autoback(-2)
screenswap

setdisplay( 1200,700,32,1)
ink( rgb(20,40,60 ))

cls

ink( rgb(245,200,255 ))
Ang1 = p2/5  :  y = 650.0

Time1 = ticks()

 Fractal (5,400)
Time2= ticks()
screenswap
ink( rgb(255,255,255 ))
locate (1,1):prints( Time2 - Time1 )

 screenswap
waitkey

end

 function  Fractal( depth , distance )


       cnt2 = 5
       cnt = 0
    if depth > 1 then
            SetColor()
  end if

      if depth > 0 then
            while cnt < cnt2
                 MoveSteps( distance)
                 RotateLeft( )
                 Fractal( depth - 1 , distance / 2.0)
              cnt = cnt + 1
                count = count + 1
            wend
            if count > 10 then
       count = 1
   end if
            depth = depth - 1

      end if
 end function

 function SetColor()

        if clr = 1 then
        ink( rgb(255,0,255 ))
     end if
      if clr = 2 then
        ink( rgb(0,255,255 ))
     end if
      if clr = 3 then
        ink( rgb(255,0,0 ))
     end if
      if clr = 4 then
        ink( rgb(0,255,0 ))
     end if
      if clr = 5 then
        ink( rgb(255,255,155 ))
     end if
      if clr = 6 then
        ink( rgb(180,200,255 ))
     end if
      if clr = 7 then
        ink( rgb(180,0,255 ))
     end if

          clr = clr + 1

      if clr > 7 then
          clr =1
   end if
 end function

 function RotateLeft()
      Ang = Ang + Ang1
      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.