Live data from Hacker News

The sierpinski triangle page to end most sierpinski triangle pages

oftenpaper.net

21–23 of 23 posts

Re: The sierpinski triangle page to end most sierpinski triangle pages

#22
If you like this kind of stuff you might also like this:

http://obadger.com/turtle/

Then paste/run this program:

    var triangle = (function(){
      function frag(len, depth, left){
        if (left === undefined) left = !(depth % 2);
        if (depth > 1) {
          frag(len/2, depth-1, !left);
          t[left?'lt':'rt'](60);
          frag(len/2, depth-1, left);
          t[left?'lt':'rt'](60);
          frag(len/2, depth-1, !left);
        } else {
          t.fd(len);
        }
      }
      return frag;
    })();

    /* position the turtle */
    t.pu().bk(250).rt(90).bk(350).pd().color('#0f0');

    /* build the triangle */
    triangle(700, 8);
Post reply on HN