mdj wrote:
On Feb 1, 9:25 am, "Michael J. Mahon" <mjma...@aol.com> wrote:IIRC, Nibble published these by the hundreds, though most of them were not really "games", but demonstrations. There were even books of one-liners published! A line is limited to the length of the input buffer--I don't recall the exact limit, but it's just under 256 characters, so one-liners are very constrained. There are several tricks for getting conditional execution within a single line, since "IF" applies to the entire remainder of the line. Think of one-liners as a kind of puzzle, rather than as a useful skill, and you've got the picture. ;-)I remember typing in one example that rendered the Mandelbrot set in hires, then waiting the 5-6 hours for it to render, just because of found it ingenious :-)
A direct evaluation of the Mandelbrot set at hires takes about seven hours whether it's a one-liner or not. ;-) I use it as a demonstration of "embarrassing parallelism" for the AppleCrate--in fact, I used it at KansasFest (though the demo was interrupted by my zapping it with ESD!). With 16 processors running it, and "jobs" assigned by line number, it get linear speedup, and runs in about 26 minutes--so the plan was that it would finish by around the middle of my talk. ;-)
These days we have http://en.wikipedia.org/wiki/The_International_Obfuscated_C_Code_Contest which carries on 'spirit' of the exercise. I however always thought it would be far more fun to have an International self-documenting code contest ;-)
Hear, hear! I think that Knuth's Literate Programming was the best example of code documentation that I've ever seen. Dijkstra used to say that any functioning code was like the tip of an iceberg in comparison to the large amount of documentation required to justify it. That sounds about right, and would translate to 250-500 lines of commentary for every 50 lines of code. -michael ******** Note new website URL ******** NadaNet and AppleCrate II for Apple II parallel computing! Home page: http://home.comcast.net/~mjmahon/ "The wastebasket is our most important design tool--and it's seriously underused."