tags:

views:

160

answers:

2

I was looking at this on the Wikipedia Page and was wondering if anyone has a working implementation of this.

I'm trying to learn Haskell, finding it slightly difficult and am working on the Koch Snowflake and Sierpinski Triangle.

Any code or suggestions welcome.

Thanks

+2  A: 

For sierpinski's triangle you can look here: http://stackoverflow.com/questions/1726698/code-golf-sierpinskis-triangle

You may also find this helpful: http://www.hardforum.com/showthread.php?p=1034927217

And here is a suggestion that may also help: http://www.rhinocerus.net/forum/lang-functional/96046-haskell-fractals-specifically-snowflakes.html

James Black
+1  A: 
  1. Calculate the points of a triangle centered in the plane.
  2. At each point of the triangle, calculate the points of a triangle one-third its size, and the other way up (flipped along its horizontal middle).
  3. Pass each triangle to step 2, pass the results of that again to step 2, and so on.
  4. Do all that again, upside down.

That should give you a list of (lists of) triangles. Now draw these triangles on the screen to the depth that you think is reasonable.

Apocalisp