News for hackers. Stuff that matters.
Re:Lorenz Attractor in 101 bytes of JS by jashkenas on Tuesday August 14, 2012 @10:26AM (#4381052)
Very neat. Attractors + <canvas> are a lot of fun...

My favorite is the Peter de Jong attractor, described here: http://paulbourke.net/fractals/peterdejong/

Here's a <canvas> version. Click and drag and release to re-seed the starting coordinates: http://jashkenas.s3.amazonaws.com/misc/deJong/deJong.html

Here's the annotated source code: http://jashkenas.s3.amazonaws.com/misc/deJong/docs/deJong.ht...

Edit: I've added a permalink button, so that you can link directly to interesting coordinates that you discover: http://jashkenas.s3.amazonaws.com/misc/deJong/deJong.html#59...

Re:Lorenz Attractor in 101 bytes of JS by dbaupp on Tuesday August 14, 2012 @10:28AM (#4381064)
In the comments on the gist there is a canvas version too: http://fiddle.jshell.net/aemkei/d99PL/show/
Re:Lorenz Attractor in 101 bytes of JS by tholman on Tuesday August 14, 2012 @12:26PM (#4381717)
Re:Lorenz Attractor in 101 bytes of JS by beneater on Tuesday August 14, 2012 @02:54PM (#4382499)
Here's a quick port to Khan Academy's new CS scratchpads: http://www.khanacademy.org/cs/lorenz-attractor/966238447
Re:Lorenz Attractor in 101 bytes of JS by julian37 on Tuesday August 14, 2012 @10:45AM (#4381126)
This looks just like the C code on Paul Burke's page [1], except that the translation to JS isn't quite correct because x gets updated before yz are calculated (and y before z) due to sequential parameter evaluation. And the 101 bytes conveniently doesn't count any of the rendering and other code.

The result is still pretty, but that's a bit too much handwaving for my taste.

[1] http://paulbourke.net/fractals/lorenz/

Re:Lorenz Attractor in 101 bytes of JS by jahewson on Tuesday August 14, 2012 @10:53AM (#4381171)
Great. It's just a shame about the boneheaded "DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE". It makes you look like a complete idiot.
Re:Lorenz Attractor in 101 bytes of JS by sp332 on Tuesday August 14, 2012 @11:00AM (#4381217)
It's really not worth licensing hassle for this amount of code.
Re:Lorenz Attractor in 101 bytes of JS by ctdonath on Tuesday August 14, 2012 @11:03AM (#4381233)
It's really not worth dragging otherwise nifty code into the gutter with unnecessary obscenity.

"Public domain" would suffice. Yes, a significant percentage of the population does have a problem with needless obscenity.

Re:Lorenz Attractor in 101 bytes of JS by EvanAnderson on Tuesday August 14, 2012 @12:44PM (#4381810)
In some jurisdictions it isn't possible for creators to disclaim all their rights. In those cases something like WTFPL (or, in a more tasteful manner, CC0) is necessary.
Re:Lorenz Attractor in 101 bytes of JS by cshesse on Tuesday August 14, 2012 @12:20PM (#4381682)
Which I suppose is why there's a 2:1 license-to-code ratio for this project.
Re:Lorenz Attractor in 101 bytes of JS by sp332 on Tuesday August 14, 2012 @12:22PM (#4381691)
Yes and even so it might not be legally valid. US copyright law is overly restrictive by default. It takes an effort to loosen it up a bit. c.f. Creative Commons project.
Re:Lorenz Attractor in 101 bytes of JS by wccrawford on Tuesday August 14, 2012 @02:08PM (#4382259)
Wouldn't that be even more reason to just pick a license that doesn't ruffle feathers? BSD is nice. So is MIT. Says the same thing but doesn't get people to post "Why'd you pick that license?" posts.
Re:Lorenz Attractor in 101 bytes of JS by sp332 on Tuesday August 14, 2012 @02:12PM (#4382280)
It's an expression of frustration at how much effort has to go into understanding licensing. For this amount of code, no author or reader should have to consider the terms of a license. (And the license-to-code ratio would be even more ridiculous. )
Re:Lorenz Attractor in 101 bytes of JS by Jach on Tuesday August 14, 2012 @03:41PM (#4382730)
No amount of code is too small, as the recent Oracle v. Google BS has shown. The rangeCheck method that was contested: http://news.ycombinator.com/item?id=3940683 (It made my day when the judge revealed he had former coding experience.) People shouldn't be worried about covering their ass for this stuff, but if they don't it could cost them. The WTFPL is also a frustration at that fact. As a bonus it eliminates the slight annoyance of people emailing/commenting and asking what the license is if one wasn't provided, at the cost of sensitive people complaining elsewhere about the profanity.

I've used a "version 3" (different version, different name!) of the WTFPL that I picked up from somewhere on a few of my projects, it has some additional legal garble that would probably beef it up just slightly if it was ever tested in court. https://github.com/Jach/lucid_demo/blob/master/COPYING

Re:Lorenz Attractor in 101 bytes of JS by gbadman on Tuesday August 14, 2012 @10:18AM (#4381006)
Link to play with it: http://plnkr.co/edit/UFLKBx

Hint: Hit the eye icon on the right for live preview.

Re:Lorenz Attractor in 101 bytes of JS by 0x0 on Tuesday August 14, 2012 @12:56PM (#4381866)
Claiming 101 bytes feels a bit like cheating, since you need a bunch of setup and painting code to drive the algorithm, don't you think? :)
Re:Lorenz Attractor in 101 bytes of JS by karpathy on Tuesday August 14, 2012 @04:01PM (#4382812)
I ported this to the newly announced Khan Academy CS sandbox :)

http://www.khanacademy.org/cs/lorenz-attractor/966338554

Re:Lorenz Attractor in 101 bytes of JS by bdon on Wednesday August 15, 2012 @02:47AM (#4384915)
Not quite 101 bytes, but here's an interactive version in WebGL:

http://bdon.github.com/strange_attractor/

(Only works in Chrome)

Re:Lorenz Attractor in 101 bytes of JS by jianshen on Tuesday August 14, 2012 @10:43AM (#4381116)
Nostalgic! Fractals are what got me interested in programming when I was a student because I always wanted to know how to "draw infinitely".
Re:Lorenz Attractor in 101 bytes of JS by blorenz on Tuesday August 14, 2012 @10:52AM (#4381169)
Good use of 101 bytes! I'm attracted to it.
Re:Lorenz Attractor in 101 bytes of JS by ehosca on Tuesday August 14, 2012 @10:27AM (#4381054)
ITT Schaub- ?