Caught up in 25-line fever, I started hacking away at a Strange attractor generator and got it down to 6 lines. 🙂
[as]var bmp:Bitmap = addChild(new Bitmap(new BitmapData(800, 800, false, 0xffffff))) as Bitmap;
for(var i:int = 0; i < 12; i++) this[“a” + (i + 1)] = ((“VBWNBDELYHUL”).charCodeAt(i) - 77) / 10; var p:Point = new Point(.1, .1); for(i = 0; i < 10000; i++) { p = new Point(this[“a” + 1] + this[“a” + 2] * p.x + this[“a” + 3] * p.x * p.x + this[“a” + 4] * p.x * p.y + this[“a” + 5] * p.y + this[“a” + 6] * p.y * p.y, this[“a” + 7] + this[“a” + 8] * p.x + this[“a” + 9] * p.x * p.x + this[“a” + 10] * p.x * p.y + this[“a” + 11] * p.y + this[“a” + 12] * p.y * p.y); bmp.bitmapData.setPixel(400 + p.x * 100, 400 - p.y * 100, 0); // 400, 400 is center. 100 is scale. } [/as] Should give you something like this:
From https://mathworld.wolfram.com/StrangeAttractor.html
The seed is the 12-character string in the second line. Valid chars are A-Y. Other seeds to try:
“VBWNBDELYHUL”, “AMTMNQQXUYGA”, “CVQKGHQTPHTE”, “FIRCDERRPVLD”, “GIIETPIQRRUL”, “GLXOESFTTPSV”, “GXQSNSKEECTX”, “HGUHDPHNSGOH”
All from the above link, where you can find even more, or try to discover your own (not so easy).
Coulda gotten rid of the seed and hard coded the parameters right into line 5, allowing me to do away with line 2 all together, but then it would be pretty useless.