News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Fibonacci Sunflower Demo in Basic

Started by Bytebreaker, 09:00, 11 September 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bytebreaker


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.

alex76gr

Thank you very much!
Dots were always something i loved in demos. :)
I still believe that i got my myopia from the green GT-65 monitor, but i can't prove it! :)

Kris

SImple but effective effect & visually lovely  ;)

litwr

#3
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.

Bytebreaker

#4
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.




litwr

Thanks for the beautiful idea.  :) It is interesting to have a multi-platform graphical demo.
Fibonacci sunflower - Commodore 64 (C64) Forum
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.

ZbyniuR

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. :)
In STARS, TREK is better than WARS.

SRS

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 !



Powered by SMFPacks Menu Editor Mod