How to resolve the algorithm Barnsley fern step by step in the Liberty BASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Barnsley fern step by step in the Liberty BASIC programming language
Table of Contents
Problem Statement
A Barnsley fern is a fractal named after British mathematician Michael Barnsley and can be created using an iterated function system (IFS).
Create this fractal fern, using the following transformations: Starting position: x = 0, y = 0
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Barnsley fern step by step in the Liberty BASIC programming language
Source code in the liberty programming language
nomainwin
WindowWidth=800
WindowHeight=600
open "Barnsley Fern" for graphics_nf_nsb as #1
#1 "trapclose [q];down;fill black;flush;color green"
for n = 1 To WindowHeight * 50
r = int(rnd(1)*100)
Select Case
Case (r>=0) and (r<=84)
xn=0.85*x+0.04*y
yn=-0.04*x+0.85*y+1.6
Case (r>84) and (r<=91)
xn=0.2*x-0.26*y
yn=0.23*x+0.22*y+1.6
Case (r>91) and (r<=98)
xn=-0.15*x+0.28*y
yn=0.26*x+0.24*y+0.44
Case Else
xn=0
yn=0.16*y
End Select
x=xn
y = yn
#1 "set ";x*80+300;" ";WindowHeight/1.1-y*50
next n
#1 "flush"
wait
[q]
close #1
You may also check:How to resolve the algorithm Symmetric difference step by step in the OCaml programming language
You may also check:How to resolve the algorithm Least common multiple step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Conway's Game of Life step by step in the Forth programming language
You may also check:How to resolve the algorithm Topological sort step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Averages/Pythagorean means step by step in the zkl programming language