From: Brian Mitchell Date: 2004-12-06T14:37:26+09:00 Subject: [SOT]Signatures and one liners readers.each{|x| puts "Hi #{x},"} As per request, I have created a thread for small programs that do neat things (we are all true geeks at heart :) ). This all started with my less than perfect Sierpinski Triangle generator: ruby -e'32.times{|y|print" "*(31-y);(y+1).times{|x|print" #{~y&x==0?"A":"."}"};puts}' I originally build the sig for my /. account but I use it from time to time on other things. This was greatly improved to: ruby -le'32.times{|y|print" "*(31-y),(0..y).map{|x|~y&x>0?" .":" A"}}' from input by the community. Now as for readability... ;) The code was not intentionally obfuscated but ended up that ways as I compressed my original script. As I had said before in another thread (Ruby 2.0), I am experimenting with some other one liners. One was my 1d cellular automata (see http://en.wikipedia.org/wiki/Cellular_automaton for more info). I went ahead and coded a small version that was originally 2d then changed to 1d because of size. This might explain the ugly code (my lack of sleep would be the other ;) ). Here is a version (not my most compact but the most interesting): # So long it might as well be four of five lines not one... # Don't try too hard to understand this one as it isn't worth it ;) R={111=>rand.round,110=>rand.round,101=>rand.round,100=>rand.round,11=>rand.round,10=>rand.round,1=>rand.round,0=>rand.round}; i="";64.times{i<