Author Topic: Sample Programs for BrowserBasic  (Read 9072 times)

Rick3137

  • Guest
Re: Sample Programs for BrowserBasic
« Reply #15 on: July 17, 2013, 05:54:48 PM »
                                 SIERPINSKI TRIANGLE

     
Code: [Select]
      '  This program written by    Rick3137
      '  http://rb23.yolasite.com/

           
                '  1 Radian = 57.2958 Degrees.
                '  1 degree = .0174532925 Radians
               
Var pendown as number
Var cnt as number
Var cnt2 as number
Var PenX as number
Var PenY as number
Var Angle as number
Var Angle2 as number
Var d as number
Var dx as number
Var dy as number
Var x1 as number
Var y1 as number
Var x2 as number
Var y2 as number
Var red as number
Var green as number
Var blue as number
        Var d as number
Var AngleR as number
Var Color as number

Function OnLoad()
  d = 550
  Angle = 270
  AngleR = 120
      PenX =  400
  PenY =  300 
      pendown = 1
  Color = 100
      setColor ( 125 , 122 , 250 )
  setBackgroundColor( 0, 0, 50)
endfunction

Function OnUpdate( dt as number )
     
endfunction

Function OnDraw()
        Color = 1
        PenX = 200
PenY = 500
x1 = PenX
y1 = PenY
x2 = 300
y2 = 400
        Angle = 60

     Fractal( d )
endfunction






Function ChangeColor( n as number )
         Color = Color + n
if Color > 99 then Color = 1 endif
SetColor2( Color )

endfunction

Function RotateRight(  n as number )

       if Angle > n then
          Angle = Angle - n
   else
      n = n - Angle
  Angle = 360 - Angle
   endif
       if Angle = 360   then  Angle = 0 endif


EndFunction

Function RotateLeft(  n as number )
         
Angle = Angle + n
         if  Angle > 360  then
         Angle = n - 360

         endif
EndFunction


Function  DegreeToRadian(  n as number )
Angle2 = n * .0174532925
EndFunction

 Function  MoveSteps ( n as number )

     DegreeToRadian ( Angle )
     dx = cos (Angle2)
     dy = sin (Angle2)
     dx = dx * n
     dy = dy * n
x2 = PenX + dx
y2 = PenY - dy
     if pendown = 1   then   line ( PenX , PenY , x2 , y2 )  endif
     PenX = PenX + dx
PenY = PenY - dy
     
 EndFunction

 

 Function Fractal (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
           
                         MoveSteps ( Distance )
        RotateRight( AngleR )
        Fractal2 ( Distance / 2 )
                         cnt = cnt + 1
                 EndWhile
  EndFunction

 Function Fractal2 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
           
                         MoveSteps ( Distance )
        RotateRight( AngleR )
        Fractal3 ( Distance / 2 )
                         cnt = cnt + 1
                EndWhile
   EndFunction

 Function Fractal3 (  Distance as number )
       Var cnt as number
       cnt = 0
       ChangeColor(5)
                 while (cnt < 3)
           
                         MoveSteps ( Distance )
        RotateRight( AngleR )
        Fractal4 ( Distance / 2 )
                         cnt = cnt + 1
                EndWhile
  EndFunction

 Function Fractal4 ( Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
           
                         MoveSteps ( Distance )
        RotateRight( AngleR )
        Fractal5 ( Distance / 2 )
                         cnt = cnt + 1
                 EndWhile
   EndFunction

 Function Fractal5 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
           
                         MoveSteps ( Distance )
        RotateRight( AngleR )
        Fractal6 ( Distance / 2 )
                         cnt = cnt + 1
                EndWhile
   EndFunction

 Function Fractal6 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
           
                         MoveSteps ( Distance )
        RotateRight( AngleR )
        Fractal7 ( Distance / 2 )
                         cnt = cnt + 1
                EndWhile
   EndFunction

   Function Fractal7 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
           
                         MoveSteps ( Distance )
        RotateRight( AngleR )
     
                         cnt = cnt + 1
                EndWhile
   EndFunction
   
   Function SetColor2( clr as number )
   
   
if clr > 99 then clr = 1 endif
if clr = 0 then clr = 1 endif
                if clr < 0 then clr = 1 endif
if clr = 1 then  setcolor (10, 10, 255) endif
if clr = 2 then  setcolor (60, 60, 255) endif
if clr = 3 then  setcolor (30, 60, 250) endif
if clr = 4 then  setcolor (40, 80, 240) endif
if clr = 5 then  setcolor (50, 100, 230) endif
if clr = 6 then  setcolor (60, 120, 230) endif
if clr = 7 then  setcolor (70, 140, 220) endif
if clr = 8 then  setcolor (80, 160, 220) endif
if clr = 9 then  setcolor (90, 180, 200) endif
if clr = 10 then setcolor (150, 255, 255) endif
if clr = 11 then setcolor (120, 230, 255) endif
if clr = 12 then setcolor (120, 210, 255) endif
if clr = 13 then setcolor (120, 180, 255) endif
if clr = 14 then setcolor (120, 160, 255) endif
if clr = 15 then setcolor (20, 140, 255) endif
if clr = 16 then setcolor (20, 255, 230) endif
if clr = 17 then setcolor (20, 255, 190) endif
if clr = 18 then setcolor (20, 255, 170) endif
if clr = 19 then setcolor (20, 255, 140) endif
if clr = 20 then setcolor (20, 255, 120) endif
if clr = 21 then setcolor (0, 255, 100)  endif
if clr = 22 then setcolor (0, 255, 90)   endif
if clr = 23 then setcolor (0, 235, 80)   endif
if clr = 24 then setcolor (0, 205, 70)   endif
if clr = 25 then setcolor (0, 90, 60)   endif
if clr = 26 then setcolor (0, 255, 50)   endif
if clr = 27 then setcolor (0, 245, 40)   endif
if clr = 28 then setcolor (0, 225, 30)   endif
if clr = 29 then setcolor (0, 215, 20)   endif
if clr = 30 then setcolor (0, 205, 10)   endif
if clr = 31 then setcolor (235, 255, 10) endif
if clr = 32 then setcolor (215, 255, 20) endif

if clr = 33 then setcolor (255, 255, 30)  endif
if clr = 34 then setcolor (255, 235, 40)  endif
if clr = 35 then setcolor (255, 215, 50)  endif
if clr = 36 then setcolor (255, 195, 60)  endif
if clr = 37 then setcolor (255, 85, 50)  endif
if clr = 38 then setcolor (255, 75, 40)  endif
if clr = 39 then setcolor (155, 155, 10)  endif
if clr = 40 then setcolor (155, 255, 10) endif
if clr = 41 then setcolor (255, 10, 255)  endif
if clr = 42 then setcolor (255, 40, 255)  endif
if clr = 43 then setcolor (255, 60, 255)  endif
if clr = 44 then setcolor (255, 180, 255)  endif
if clr = 45 then setcolor (255, 10, 255)  endif
if clr = 46 then setcolor (235, 10, 255)  endif
if clr = 47 then setcolor (215, 10, 255)  endif
if clr = 48 then setcolor (195, 80, 255)  endif
if clr = 49 then setcolor (255, 90, 195)  endif
                if clr = 50 then setcolor (255, 90, 165)  endif
                if clr = 51 then  setcolor (10, 20, 255) endif
if clr = 52 then  setcolor (40, 40, 255) endif
if clr = 53 then  setcolor (80, 80, 255) endif
if clr = 54 then  setcolor (40, 80, 255) endif
if clr = 55 then  setcolor (50, 100, 255) endif
if clr = 56 then  setcolor (60, 120, 255) endif
if clr = 57 then  setcolor (70, 140, 255) endif
if clr = 58 then  setcolor (80, 160, 255) endif
if clr = 59 then  setcolor (90, 180, 255) endif
if clr = 60 then setcolor (150, 200, 255) endif
if clr = 61 then setcolor (10, 255, 255) endif
if clr = 62 then setcolor (20, 255, 235) endif
if clr = 63 then setcolor (30, 255, 215) endif
if clr = 64 then setcolor (40, 255, 195) endif
if clr = 65 then setcolor (50, 235, 255) endif
if clr = 66 then setcolor (50, 215, 255) endif
if clr = 67 then setcolor (50, 195, 255) endif
if clr = 68 then setcolor (50, 95, 255) endif
if clr = 69 then setcolor (50, 155, 155) endif
if clr = 70 then setcolor (100, 255, 255) endif
if clr = 71 then setcolor (0, 255, 200)  endif
if clr = 72 then setcolor (0, 255, 180)   endif
if clr = 73 then setcolor (0, 255, 160)   endif
if clr = 74 then setcolor (0, 255, 140)   endif
if clr = 75 then setcolor (0, 255, 120)   endif
if clr = 76 then setcolor (0, 255, 50)   endif
if clr = 77 then setcolor (0, 215, 40)   endif
if clr = 78 then setcolor (50, 255, 30)   endif
if clr = 79 then setcolor (90, 255, 20)   endif
if clr = 80 then setcolor (110, 255, 10)   endif
if clr = 81 then setcolor (255, 255, 10) endif
if clr = 82 then setcolor (255, 255, 20) endif

if clr = 83 then setcolor (255, 255, 30)  endif
if clr = 84 then setcolor (255, 255, 40)  endif
if clr = 85 then setcolor (255, 255, 50)  endif
if clr = 86 then setcolor (255, 255, 60)  endif
if clr = 87 then setcolor (255, 255, 70)  endif
if clr = 88 then setcolor (255, 255, 80)  endif
if clr = 89 then setcolor (255, 255, 90)  endif
if clr = 90 then setcolor (255, 255, 100) endif
if clr = 91 then setcolor (255, 10, 255)  endif
if clr = 92 then setcolor (255, 20, 255)  endif
if clr = 93 then setcolor (255, 30, 255)  endif
if clr = 94 then setcolor (255, 40, 255)  endif
if clr = 95 then setcolor (255, 50, 255)  endif
if clr = 96 then setcolor (255, 60, 255)  endif
if clr = 97 then setcolor (255, 70, 255)  endif
if clr = 98 then setcolor (255, 80, 255)  endif
if clr = 99 then setcolor (255, 90, 255)  endif


endfunction
   

Guilect

  • Guest
Re: Sample Programs for BrowserBasic
« Reply #16 on: July 17, 2013, 09:36:42 PM »
SIERPINSKI TRIANGLE; very colorful and ... triangular.

Rick3137

  • Guest
Re: Sample Programs for BrowserBasic
« Reply #17 on: July 18, 2013, 07:54:44 PM »
                         THE SQUARE ROOT OF A TRIANGLE

     
Code: [Select]
      '  This program written by    Rick3137
      '  http://rb23.yolasite.com/

           
                '  1 Radian = 57.2958 Degrees.
                '  1 degree = .0174532925 Radians
               
Var pendown as number
Var cnt as number
Var cnt2 as number
Var PenX as number
Var PenY as number
Var Angle as number
Var Angle2 as number
Var d as number
Var dx as number
Var dy as number
Var x1 as number
Var y1 as number
Var x2 as number
Var y2 as number
Var red as number
Var green as number
Var blue as number
        Var d as number
Var AngleR as number
Var Color as number

Function OnLoad()
  d = 450
  Angle = 270
  AngleR = 120
      PenX =  350
  PenY =  400 
      pendown = 1
  Color = 100
      setColor ( 125 , 122 , 250 )
  setBackgroundColor( 0, 0, 50)
endfunction

Function OnUpdate( dt as number )
     
endfunction

Function OnDraw()
        Color = 1
        PenX = 280
PenY = 370

        Angle = 0

     Fractal( d )
endfunction






Function ChangeColor( n as number )
         Color = Color + n
if Color > 99 then Color = 1 endif
SetColor2( Color )

endfunction

Function RotateRight(  n as number )

       if Angle > n then
          Angle = Angle - n
   else
      n = n - Angle
  Angle = 360 - Angle
   endif
       if Angle = 360   then  Angle = 0 endif


EndFunction

Function RotateLeft(  n as number )
         
Angle = Angle + n
         if  Angle > 360  then
         Angle = Angle - 360

         endif
EndFunction


Function  DegreeToRadian(  n as number )
Angle2 = n * .0174532925
EndFunction

 Function  MoveSteps ( n as number )

     DegreeToRadian ( Angle )
     dx = cos (Angle2)
     dy = sin (Angle2)
     dx = dx * n
     dy = dy * n
x2 = PenX + dx
y2 = PenY - dy
     if pendown = 1   then   line ( PenX , PenY , x2 , y2 )  endif
     PenX = PenX + dx
PenY = PenY - dy
     
 EndFunction

 

 Function Fractal (  Distance as number )
       Var cnt1 as number
       cnt1 = 0
            while (cnt1 < 4)
           
            MoveSteps ( Distance /4 )
       
Fractal2 ( Distance /2 )
MoveSteps ( Distance /4 )
RotateLeft( 90 )
            cnt1 = cnt1 + 1

            EndWhile
  EndFunction

 Function Fractal2 (  Distance as number )
       Var cnt2 as number
       cnt2 = 0
                 while (cnt2 < 3)
                   RotateLeft( AngleR )
                   MoveSteps ( Distance )
       
               Fractal3 ( Distance / 2 )
                   cnt2 = cnt2 + 1
                   EndWhile
   EndFunction

 Function Fractal3 (  Distance as number )
       Var cnt as number
       cnt = 0
       ChangeColor(5)
                 while (cnt < 3)
            RotateLeft( AngleR )
            MoveSteps ( Distance )
       
        Fractal4 ( Distance / 2 )
            cnt = cnt + 1
            EndWhile
  EndFunction

 Function Fractal4 ( Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
            RotateLeft( AngleR )
            MoveSteps ( Distance )
        Fractal5 ( Distance / 2 )
            cnt = cnt + 1
                 EndWhile
   EndFunction

 Function Fractal5 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
            RotateLeft( AngleR )
            MoveSteps ( Distance )
        Fractal6 ( Distance / 2 )
            cnt = cnt + 1
                EndWhile
   EndFunction

 Function Fractal6 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
            RotateLeft( AngleR )
            MoveSteps ( Distance )
        Fractal7 ( Distance / 2 )
            cnt = cnt + 1
                EndWhile
   EndFunction

   Function Fractal7 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
                RotateLeft( AngleR )
                MoveSteps ( Distance )
            cnt = cnt + 1
                 EndWhile
   EndFunction
   
   Function SetColor2( clr as number )
   
   
if clr > 99 then clr = 1 endif
if clr = 0 then clr = 1 endif
                if clr < 0 then clr = 1 endif
if clr = 1 then  setcolor (10, 10, 255) endif
if clr = 2 then  setcolor (60, 60, 255) endif
if clr = 3 then  setcolor (30, 60, 250) endif
if clr = 4 then  setcolor (40, 80, 240) endif
if clr = 5 then  setcolor (50, 100, 230) endif
if clr = 6 then  setcolor (60, 120, 230) endif
if clr = 7 then  setcolor (70, 140, 220) endif
if clr = 8 then  setcolor (80, 160, 220) endif
if clr = 9 then  setcolor (90, 180, 200) endif
if clr = 10 then setcolor (150, 255, 255) endif
if clr = 11 then setcolor (120, 230, 255) endif
if clr = 12 then setcolor (120, 210, 255) endif
if clr = 13 then setcolor (120, 180, 255) endif
if clr = 14 then setcolor (120, 160, 255) endif
if clr = 15 then setcolor (20, 140, 255) endif
if clr = 16 then setcolor (20, 255, 230) endif
if clr = 17 then setcolor (20, 255, 190) endif
if clr = 18 then setcolor (20, 255, 170) endif
if clr = 19 then setcolor (20, 255, 140) endif
if clr = 20 then setcolor (20, 255, 120) endif
if clr = 21 then setcolor (0, 255, 100)  endif
if clr = 22 then setcolor (0, 255, 90)   endif
if clr = 23 then setcolor (0, 235, 80)   endif
if clr = 24 then setcolor (0, 205, 70)   endif
if clr = 25 then setcolor (0, 90, 60)   endif
if clr = 26 then setcolor (0, 255, 50)   endif
if clr = 27 then setcolor (0, 245, 40)   endif
if clr = 28 then setcolor (0, 225, 30)   endif
if clr = 29 then setcolor (0, 215, 20)   endif
if clr = 30 then setcolor (0, 205, 10)   endif
if clr = 31 then setcolor (235, 255, 10) endif
if clr = 32 then setcolor (215, 255, 20) endif

if clr = 33 then setcolor (255, 255, 30)  endif
if clr = 34 then setcolor (255, 235, 40)  endif
if clr = 35 then setcolor (255, 215, 50)  endif
if clr = 36 then setcolor (255, 195, 60)  endif
if clr = 37 then setcolor (255, 85, 50)  endif
if clr = 38 then setcolor (255, 75, 40)  endif
if clr = 39 then setcolor (155, 155, 10)  endif
if clr = 40 then setcolor (155, 255, 10) endif
if clr = 41 then setcolor (255, 10, 255)  endif
if clr = 42 then setcolor (255, 40, 255)  endif
if clr = 43 then setcolor (255, 60, 255)  endif
if clr = 44 then setcolor (255, 180, 255)  endif
if clr = 45 then setcolor (255, 10, 255)  endif
if clr = 46 then setcolor (235, 10, 255)  endif
if clr = 47 then setcolor (215, 10, 255)  endif
if clr = 48 then setcolor (195, 80, 255)  endif
if clr = 49 then setcolor (255, 90, 195)  endif
                if clr = 50 then setcolor (255, 90, 165)  endif
                if clr = 51 then  setcolor (10, 20, 255) endif
if clr = 52 then  setcolor (40, 40, 255) endif
if clr = 53 then  setcolor (80, 80, 255) endif
if clr = 54 then  setcolor (40, 80, 255) endif
if clr = 55 then  setcolor (50, 100, 255) endif
if clr = 56 then  setcolor (60, 120, 255) endif
if clr = 57 then  setcolor (70, 140, 255) endif
if clr = 58 then  setcolor (80, 160, 255) endif
if clr = 59 then  setcolor (90, 180, 255) endif
if clr = 60 then setcolor (150, 200, 255) endif
if clr = 61 then setcolor (10, 255, 255) endif
if clr = 62 then setcolor (20, 255, 235) endif
if clr = 63 then setcolor (30, 255, 215) endif
if clr = 64 then setcolor (40, 255, 195) endif
if clr = 65 then setcolor (50, 235, 255) endif
if clr = 66 then setcolor (50, 215, 255) endif
if clr = 67 then setcolor (50, 195, 255) endif
if clr = 68 then setcolor (50, 95, 255) endif
if clr = 69 then setcolor (50, 155, 155) endif
if clr = 70 then setcolor (100, 255, 255) endif
if clr = 71 then setcolor (0, 255, 200)  endif
if clr = 72 then setcolor (0, 255, 180)   endif
if clr = 73 then setcolor (0, 255, 160)   endif
if clr = 74 then setcolor (0, 255, 140)   endif
if clr = 75 then setcolor (0, 255, 120)   endif
if clr = 76 then setcolor (0, 255, 50)   endif
if clr = 77 then setcolor (0, 215, 40)   endif
if clr = 78 then setcolor (50, 255, 30)   endif
if clr = 79 then setcolor (90, 255, 20)   endif
if clr = 80 then setcolor (110, 255, 10)   endif
if clr = 81 then setcolor (255, 255, 10) endif
if clr = 82 then setcolor (255, 255, 20) endif

if clr = 83 then setcolor (255, 255, 30)  endif
if clr = 84 then setcolor (255, 255, 40)  endif
if clr = 85 then setcolor (255, 255, 50)  endif
if clr = 86 then setcolor (255, 255, 60)  endif
if clr = 87 then setcolor (255, 255, 70)  endif
if clr = 88 then setcolor (255, 255, 80)  endif
if clr = 89 then setcolor (255, 255, 90)  endif
if clr = 90 then setcolor (255, 255, 100) endif
if clr = 91 then setcolor (255, 10, 255)  endif
if clr = 92 then setcolor (255, 20, 255)  endif
if clr = 93 then setcolor (255, 30, 255)  endif
if clr = 94 then setcolor (255, 40, 255)  endif
if clr = 95 then setcolor (255, 50, 255)  endif
if clr = 96 then setcolor (255, 60, 255)  endif
if clr = 97 then setcolor (255, 70, 255)  endif
if clr = 98 then setcolor (255, 80, 255)  endif
if clr = 99 then setcolor (255, 90, 255)  endif


endfunction
   

Rick3137

  • Guest
Re: Sample Programs for BrowserBasic
« Reply #18 on: July 22, 2013, 10:06:06 PM »
                               TRIANGULAR PENTAGON

   
Code: [Select]
      '  This program written by    Rick3137
      '  http://rb23.yolasite.com/

           
                '  1 Radian = 57.2958 Degrees.
                '  1 degree = .0174532925 Radians
               
Var pendown as number
Var cnt as number
Var cnt2 as number
Var PenX as number
Var PenY as number
Var Angle as number
Var Angle2 as number
Var d as number
Var dx as number
Var dy as number
Var x1 as number
Var y1 as number
Var x2 as number
Var y2 as number
Var red as number
Var green as number
Var blue as number
        Var d as number
Var AngleR as number
Var Color as number

Function OnLoad()
  d = 650
  AngleR = 120
      pendown = 1
  Color = 100
      setColor ( 125 , 122 , 250 )
  setBackgroundColor( 0, 0, 50)
endfunction

Function OnUpdate( dt as number )
     
endfunction

Function OnDraw()
        Color = 1
        PenX = 280
PenY = 510

        Angle = 0

     Fractal( d )
endfunction






Function ChangeColor( n as number )
         Color = Color + n
if Color > 99 then Color = 1 endif
SetColor2( Color )

endfunction

Function RotateRight(  n as number )

       if Angle > n then
          Angle = Angle - n
   else
      n = n - Angle
  Angle = 360 - Angle
   endif
       if Angle = 360   then  Angle = 0 endif


EndFunction

Function RotateLeft(  n as number )
         
Angle = Angle + n
         if  Angle > 360  then
         Angle = Angle - 360

         endif
EndFunction


Function  DegreeToRadian(  n as number )
Angle2 = n * .0174532925
EndFunction

 Function  MoveSteps ( n as number )

     DegreeToRadian ( Angle )
     dx = cos (Angle2)
     dy = sin (Angle2)
     dx = dx * n
     dy = dy * n
x2 = PenX + dx
y2 = PenY - dy
     if pendown = 1   then   line ( PenX , PenY , x2 , y2 )  endif
     PenX = PenX + dx
PenY = PenY - dy
     
 EndFunction

 

 Function Fractal (  Distance as number )
       Var cnt1 as number
       cnt1 = 0
            while (cnt1 < 5)
           
            MoveSteps ( Distance /4 )
       
Fractal2 ( Distance /2 )
MoveSteps ( Distance /4 )
RotateLeft( 72 )
            cnt1 = cnt1 + 1

            EndWhile
  EndFunction

 Function Fractal2 (  Distance as number )
       Var cnt2 as number
       cnt2 = 0
                 while (cnt2 < 5)
                   RotateLeft( 72 )
                   MoveSteps ( Distance/2 )
       
               Fractal3 ( Distance / 2 )
                   cnt2 = cnt2 + 1
                   EndWhile
   EndFunction

 Function Fractal3 (  Distance as number )
       Var cnt as number
       cnt = 0
       ChangeColor(5)
                 while (cnt < 3)
            RotateLeft( AngleR )
            MoveSteps ( Distance * .8 )
       
        Fractal4 ( Distance / 2 )
            cnt = cnt + 1
            EndWhile
  EndFunction

 Function Fractal4 ( Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
            RotateLeft( AngleR )
            MoveSteps ( Distance )
        Fractal5 ( Distance / 2 )
            cnt = cnt + 1
                 EndWhile
   EndFunction

 Function Fractal5 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
            RotateLeft( AngleR )
            MoveSteps ( Distance )
        Fractal6 ( Distance / 2 )
            cnt = cnt + 1
                EndWhile
   EndFunction

 Function Fractal6 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
            RotateLeft( AngleR )
            MoveSteps ( Distance )
        Fractal7 ( Distance / 2 )
            cnt = cnt + 1
                EndWhile
   EndFunction

   Function Fractal7 (  Distance as number )
       Var cnt as number
       cnt = 0
                 while (cnt < 3)
                RotateLeft( AngleR )
                MoveSteps ( Distance )
            cnt = cnt + 1
                 EndWhile
   EndFunction
   
   Function SetColor2( clr as number )
   
   
if clr > 99 then clr = 1 endif
if clr = 0 then clr = 1 endif
                if clr < 0 then clr = 1 endif
if clr = 1 then  setcolor (10, 10, 255) endif
if clr = 2 then  setcolor (60, 60, 255) endif
if clr = 3 then  setcolor (30, 60, 250) endif
if clr = 4 then  setcolor (40, 80, 240) endif
if clr = 5 then  setcolor (50, 100, 230) endif
if clr = 6 then  setcolor (60, 120, 230) endif
if clr = 7 then  setcolor (70, 140, 220) endif
if clr = 8 then  setcolor (80, 160, 220) endif
if clr = 9 then  setcolor (90, 180, 200) endif
if clr = 10 then setcolor (150, 255, 255) endif
if clr = 11 then setcolor (120, 230, 255) endif
if clr = 12 then setcolor (120, 210, 255) endif
if clr = 13 then setcolor (120, 180, 255) endif
if clr = 14 then setcolor (120, 160, 255) endif
if clr = 15 then setcolor (20, 140, 255) endif
if clr = 16 then setcolor (20, 255, 230) endif
if clr = 17 then setcolor (20, 255, 190) endif
if clr = 18 then setcolor (20, 255, 170) endif
if clr = 19 then setcolor (20, 255, 140) endif
if clr = 20 then setcolor (20, 255, 120) endif
if clr = 21 then setcolor (0, 255, 100)  endif
if clr = 22 then setcolor (0, 255, 90)   endif
if clr = 23 then setcolor (0, 235, 80)   endif
if clr = 24 then setcolor (0, 205, 70)   endif
if clr = 25 then setcolor (0, 90, 60)   endif
if clr = 26 then setcolor (0, 255, 50)   endif
if clr = 27 then setcolor (0, 245, 40)   endif
if clr = 28 then setcolor (0, 225, 30)   endif
if clr = 29 then setcolor (0, 215, 20)   endif
if clr = 30 then setcolor (0, 205, 10)   endif
if clr = 31 then setcolor (235, 255, 10) endif
if clr = 32 then setcolor (215, 255, 20) endif

if clr = 33 then setcolor (255, 255, 30)  endif
if clr = 34 then setcolor (255, 235, 40)  endif
if clr = 35 then setcolor (255, 215, 50)  endif
if clr = 36 then setcolor (255, 195, 60)  endif
if clr = 37 then setcolor (255, 85, 50)  endif
if clr = 38 then setcolor (255, 75, 40)  endif
if clr = 39 then setcolor (155, 155, 10)  endif
if clr = 40 then setcolor (155, 255, 10) endif
if clr = 41 then setcolor (255, 10, 255)  endif
if clr = 42 then setcolor (255, 40, 255)  endif
if clr = 43 then setcolor (255, 60, 255)  endif
if clr = 44 then setcolor (255, 180, 255)  endif
if clr = 45 then setcolor (255, 10, 255)  endif
if clr = 46 then setcolor (235, 10, 255)  endif
if clr = 47 then setcolor (215, 10, 255)  endif
if clr = 48 then setcolor (195, 80, 255)  endif
if clr = 49 then setcolor (255, 90, 195)  endif
                if clr = 50 then setcolor (255, 90, 165)  endif
                if clr = 51 then  setcolor (10, 20, 255) endif
if clr = 52 then  setcolor (40, 40, 255) endif
if clr = 53 then  setcolor (80, 80, 255) endif
if clr = 54 then  setcolor (40, 80, 255) endif
if clr = 55 then  setcolor (50, 100, 255) endif
if clr = 56 then  setcolor (60, 120, 255) endif
if clr = 57 then  setcolor (70, 140, 255) endif
if clr = 58 then  setcolor (80, 160, 255) endif
if clr = 59 then  setcolor (90, 180, 255) endif
if clr = 60 then setcolor (150, 200, 255) endif
if clr = 61 then setcolor (10, 255, 255) endif
if clr = 62 then setcolor (20, 255, 235) endif
if clr = 63 then setcolor (30, 255, 215) endif
if clr = 64 then setcolor (40, 255, 195) endif
if clr = 65 then setcolor (50, 235, 255) endif
if clr = 66 then setcolor (50, 215, 255) endif
if clr = 67 then setcolor (50, 195, 255) endif
if clr = 68 then setcolor (50, 95, 255) endif
if clr = 69 then setcolor (50, 155, 155) endif
if clr = 70 then setcolor (100, 255, 255) endif
if clr = 71 then setcolor (0, 255, 200)  endif
if clr = 72 then setcolor (0, 255, 180)   endif
if clr = 73 then setcolor (0, 255, 160)   endif
if clr = 74 then setcolor (0, 255, 140)   endif
if clr = 75 then setcolor (0, 255, 120)   endif
if clr = 76 then setcolor (0, 255, 50)   endif
if clr = 77 then setcolor (0, 215, 40)   endif
if clr = 78 then setcolor (50, 255, 30)   endif
if clr = 79 then setcolor (90, 255, 20)   endif
if clr = 80 then setcolor (110, 255, 10)   endif
if clr = 81 then setcolor (255, 255, 10) endif
if clr = 82 then setcolor (255, 255, 20) endif

if clr = 83 then setcolor (255, 255, 30)  endif
if clr = 84 then setcolor (255, 255, 40)  endif
if clr = 85 then setcolor (255, 255, 50)  endif
if clr = 86 then setcolor (255, 255, 60)  endif
if clr = 87 then setcolor (255, 255, 70)  endif
if clr = 88 then setcolor (255, 255, 80)  endif
if clr = 89 then setcolor (255, 255, 90)  endif
if clr = 90 then setcolor (255, 255, 100) endif
if clr = 91 then setcolor (255, 10, 255)  endif
if clr = 92 then setcolor (255, 20, 255)  endif
if clr = 93 then setcolor (255, 30, 255)  endif
if clr = 94 then setcolor (255, 40, 255)  endif
if clr = 95 then setcolor (255, 50, 255)  endif
if clr = 96 then setcolor (255, 60, 255)  endif
if clr = 97 then setcolor (255, 70, 255)  endif
if clr = 98 then setcolor (255, 80, 255)  endif
if clr = 99 then setcolor (255, 90, 255)  endif


endfunction
   

Guilect

  • Guest
Re: Sample Programs for BrowserBasic
« Reply #19 on: July 22, 2013, 11:33:09 PM »
@Rick3137
Very nice examples.
Thanks for sharing them with us.