Click to See Complete Forum and Search --> : Little programming challenge
/\/\isanThr0p
Jun 16th, 2002, 04:46 AM
Hey everyone
well download the little attachement and try if you write a code that will produce the same...
(this is just the first version I think I will put something else up soon, if I find some time)
a little hint:
This is really simple (you might have done it in some programming class in school), don't think about any heavy math solution... I programmed this within 5 minuntes.
and if you wanna try this use the getpixel and setpixel api, using pset will be to slow for most machines...
/\/\isanThr0p
Jun 16th, 2002, 04:55 AM
alright I attached a picture so you can take a quick look
the pattern can be changed completely with hardly any code change...
(I chose this pattern because it is the clearest one so it's easy to analyze it)
http://209.120.143.185/attachment.php?s=&postid=1052896
Zaei
Jun 16th, 2002, 11:16 AM
Its a Sierpinski gasket =).
Shall I include the method? =).
Hint: Recursion.
Z.
/\/\isanThr0p
Jun 16th, 2002, 01:09 PM
on my first post I was thinking about asking for Zaei not to tell everyone how it works...
I did not know that it is a siepinski gasket...
it is a cellular automat to me....
VirtuallyVB
Jun 16th, 2002, 02:32 PM
Although they are probably all related, it reminded me of this technique that Stephen Wolfram is trying to use to make an equation for the universe or some such in his lates research.
Supposed to be based on a type of seed and then applying simple rules, it generates a pattern.
/\/\isanThr0p
Jun 16th, 2002, 02:46 PM
haha you know what? I learned about those automats some time ago, but reading a review about Wolframs book "a new science" I believe it is, made me write this :)
Janus
Jun 17th, 2002, 07:59 PM
Is it alright to use C or do we have to use VB?
Arbiter
Jun 18th, 2002, 02:47 AM
I'm doing it in SQL.... :p
Janus
Jun 18th, 2002, 03:30 AM
Well, I had it done like 4 hours ago, but vbforums.com went down.
Anyway, here it is. Fully commented, very optimized, and at least decently readable :P
/\/\isanThr0p
Jun 18th, 2002, 05:15 AM
alright I guess I can't post my code :)
I did not intend to go for Sierpinski I just programmed a cellular automat and played around and since I rembered having seen this one before I posted this... .
well my code is pretty crappy I guess...
/\/\isanThr0p
Jun 18th, 2002, 05:29 AM
I am impressed Janus...
(I guess I posted this for some beginners to give it some thought, but well you posted a great example on how to work with pixels and stuff... all I did in my code was getpixel in the line above and if its white do that if not do that....all simple (and slow))
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.