|
Post by David Drake on Feb 18, 2020 11:34:19 GMT -5
I created the code below for the Barnsley Fern task on Rosetta Code ( rosettacode.org/wiki/Barnsley_fern). The task is described at the top of the page. I adapted already posted code for IS-BASIC. Please post comments or suggestions. 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
|
|
|
Post by David Drake on Feb 21, 2020 7:21:58 GMT -5
Before I post this to Rosetta Code, I welcome any comments or improvements from the community.
|
|
|
Post by Rod on Feb 21, 2020 8:11:50 GMT -5
Perfect.
|
|
|
Post by tsh73 on Feb 21, 2020 9:26:53 GMT -5
Ahh, what a beauty Perfect.
|
|
|
Post by David Drake on Feb 21, 2020 11:27:49 GMT -5
|
|
|
Post by David Drake on Feb 21, 2020 11:28:43 GMT -5
Ahh, what a beauty Perfect. Thank you very much!
|
|
ntech
New Member
Posts: 49
|
Post by ntech on Feb 21, 2020 14:53:38 GMT -5
It's awesome.
|
|
|
Post by David Drake on Feb 25, 2020 8:30:12 GMT -5
I have posted the code to Rosetta Code.
|
|