Author Topic: Barnsley's Fern (BlitzMax)  (Read 1171 times)

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Barnsley's Fern (BlitzMax)
« on: September 19, 2018, 04:35:33 PM »
I do actually like BlitzMax ...  ;) It's a great language for graphics/games, I will dig deeper into it for sure. Just a small example:

Code: [Select]
' *** Barnley's Fern ***
AppTitle ="Barnley's Fern"
Graphics 512,768,0
SetClsColor (0,0,0)
SetColor (20,200,25)
Cls
Local x:Double = 0
Local y:Double = 0
Local x1:Double =0
Local x2:Double = 0
Local r:Double=0
Local go:Int = False

For Local n:Int=1 To 100000
r=RndDouble()
If r <=0.01 Then
  x=0
  y=0.16*y
  go = True
ElseIf r<=0.07 Then
  x=0.2*x-0.26*y
  y=0.23*x+0.22*y+1.6
  go = True
ElseIf r<=0.15 Then
  x=-0.15*x+0.28*y
  y=0.26*x+0.24*y+0.44
  go = True
EndIf
If go = False Then
  x=0.85*x+0.04*y
  y=-0.04*x+0.85*y+1.6
EndIf

x1=(x+3)*70
x2=700-y*70
Plot (Int(x1),Int(x2))
go = False

Next

DrawText "Press any key to exit." ,0,0
Flip
WaitKey