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,cnt )
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,cnt)
      clr = cnt + 1
                 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(0,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,255 ))
     end if
      if clr = 6 then
        ink( rgb(180,200,255 ))
     end if
      if clr = 7 then
        ink( rgb(180,0,255 ))
     end if


 end function

 function RotateLeft()
      Ang = Ang + Ang1
      if Ang > p2 then
       Ang = Ang - p2
   end if

 end function

 function MoveSteps ( distance,cnt )

        dx = cos(Ang) * distance
        dy = sin(Ang) * distance
        x2 = x + dx
        y2 = y - dy

        line( x,y,x2,y2)
  if cnt > 5 then
         line( x+1,y+1,x2+1,y2+1)
  end if
   if cnt > 4 then
         line( x+2,y+2,x2+2,y2+2)
  end if
   if cnt > 3 then
         line( x+3,y+3,x2+3,y2+3)
  end if
   if cnt > 2 then
         line( x+4,y+4,x2+4,y2+4)
  end if
   if cnt > 1 then
         line( x+5,y+5,x2+5,y2+5)
  end if
        x = x2 : y = y2
 end function

end


 

Make a free website with Yola