How to resolve the algorithm Barnsley fern step by step in the Locomotive Basic programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Barnsley fern step by step in the Locomotive 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 Locomotive Basic programming language
Source code in the locomotive programming language
10 mode 2:ink 0,0:ink 1,18:randomize time
20 scale=38
30 maxpoints=20000: x=0: y=0
40 for z=1 to maxpoints
50 p=rnd*100
60 if p<=1 then nx=0: ny=0.16*y: goto 100
70 if p<=8 then nx=0.2*x-0.26*y: ny=0.23*x+0.22*y+1.6: goto 100
80 if p<=15 then nx=-0.15*x+0.28*y: ny=0.26*x+0.24*y+0.44: goto 100
90 nx=0.85*x+0.04*y: ny=-0.04*x+0.85*y+1.6
100 x=nx: y=ny
110 plot scale*x+320,scale*y
120 next
You may also check:How to resolve the algorithm Truncatable primes step by step in the Nim programming language
You may also check:How to resolve the algorithm Terminal control/Preserve screen step by step in the UNIX Shell programming language
You may also check:How to resolve the algorithm Nim game step by step in the MiniScript programming language
You may also check:How to resolve the algorithm Sierpinski carpet step by step in the Rust programming language
You may also check:How to resolve the algorithm Hofstadter-Conway $10,000 sequence step by step in the Phix programming language