CPCWiki forum

General Category => Demos => Topic started by: Bytebreaker on 09:00, 11 September 16

Title: Fibonacci Sunflower Demo in Basic
Post by: Bytebreaker on 09:00, 11 September 16

Hello,


I was inspired by the mathematical PI Demo here and decided to work a little bit on Fibonacci numbers.


fibo1.bas lets you play a little bit.
1.) First you have to enter how many fibonacci numbers you want to generate and print on screen.
2.) Then you have to enter parameters for the fibonacci dot cloud the computer will plot.


You get a nice and tight cloud with


dots = 500
spread angle = 137.5 (the golden angle)
custom radius growth = 0.4


You can also say


dots = 100
spread angle = 137.5
custom radius growth = 2


This plots 100 dots evenly on the whole screen area instead of 500


Try also other spread angles such as 222.5 or 63.70


3.) fibo2.bas is a graphical demo plotting filled circles instead of dots.
I used a trick I learned from SRS to draw the circles fast. Just make a 24 sided polygon with draw command instead of plotting 360 dots each time.


Have fun and enjoy.
Title: Re: Fibonacci Sunflower Demo in Basic
Post by: alex76gr on 10:07, 11 September 16
Thank you very much!
Dots were always something i loved in demos. :)
Title: Re: Fibonacci Sunflower Demo in Basic
Post by: Kris on 10:31, 11 September 16
SImple but effective effect & visually lovely  ;)
Title: Re: Fibonacci Sunflower Demo in Basic
Post by: litwr on 12:04, 12 September 16
I've just converted FIBO2 to Commodore Basic and added time check.  Commodore has to use 160x200 multicolor graphic mode for this demo.
Amstrad CPC got 169.5 seconds, Commodore +4 - 363.1 s., Commodore 128 - 456.5 s.
[attachimg=1]
Commodore can't print correct font at the multicolor mode.
Title: Re: Fibonacci Sunflower Demo in Basic
Post by: Bytebreaker on 08:04, 14 September 16
litwr,


this is great!
Can you provide .d64 or .prg files or text files?



I see you use Commodore Basic V. 3.5 and higher. No C64 V2 Basic in which such a demo would not be possible without a graphics extension.


Edit: CPC being the fastest is no surprise. But I hadn't thought that the C128 is slower than Plus/4.



Title: Re: Fibonacci Sunflower Demo in Basic
Post by: litwr on 18:08, 14 September 16
Thanks for the beautiful idea.  :) It is interesting to have a multi-platform graphical demo.
Fibonacci sunflower - Commodore 64 (C64) Forum (http://www.lemon64.com/forum/viewtopic.php?t=61877)
CIRCLE command makes the code 20 times faster...
IMHO C128 is the shame for CBM.  It is even slower than C64.  It has good Basic 7 but it is too slow without compilation and has no support of VDC graphics.  I could recommend to buy Amstrad CPC6128 and C64 instead of C128 at 80s.  It was about the same price.
Title: Re: Fibonacci Sunflower Demo in Basic
Post by: ZbyniuR on 18:57, 17 September 16
Bytebreaker - I modify your FIBO2 and saved as FIBO3. Now it's work about 8 times faster. :)

With DEG in first line can look more tidy, but I like more messy. :)
Title: Re: Fibonacci Sunflower Demo in Basic
Post by: SRS on 21:39, 17 September 16
now if you use the fact that sin/cos repeats every 180 degrees and sin(a) is cos(90-a) you may speed it up another ... dunno .. time !

Title: Re: Fibonacci Sunflower Demo in Basic
Post by: litwr on 11:27, 28 October 16
http://cbmandelbrot.blogspot.sk/ (http://cbmandelbrot.blogspot.sk/)  :) The idea continues its trip among retro platforms.

Powered by SMFPacks Menu Editor Mod