From: "Brian Schröder" Date: 2004-12-08T10:16:44+09:00 Subject: Re: Duck images On Tue, 7 Dec 2004 07:00:10 +0900 Florian Frank wrote: > Michael DeHaan wrote: > [...] > > I got an idea... > > -- > Florian Frank > > I took this to play a bit with golfing and here are my first ever golfs: # Franks original Version: 186 Bytes s="\033[2J\033[0;0H _\n Quack! >(')____,\n (` =~~/\nv^v^v^v^v^`---'v^v^v^v^";(1..(1/0.0)).each{|i|s[23,6]=(i%2)==0?"Quack!":" "*6;s.tr!('>v^^v<','<^vv^>');puts s;sleep 1} # Shortened and enhanced: 178 Bytes s="\e[2J\e[0;0H _\n Quack! >(*)____,\n (` =~~/\nv^v^v^v^v^`---'v^v^v^v^";i=0;loop{s[23,6]=(i+=1)%2==0?'Quack!':' '*6;s.tr!(t="*.>v^<,�",t.reverse);puts s;sleep 1} # Packed (RLE): 205 Bytes s="\e[2J\e[0;0H"+" 30_\n 21Quack! >(*)_4,\n 29(` =~2/\nw15`-3'w15\n w33".gsub(/(.)(\d+)/){$1*$2.to_i}.gsub('w','v^');i=0;loop{s[63,6]=(i+=1)%2==0? 'Quack!':' '*6;s.tr!(t="*.>v^<,�",t.reverse);puts s;sleep 1} I enhanced the original version to waggle with the tail and blinker with the eyes. I could shorten the original by immense 8 bytes. I then tried to rle encode the string, but this resulted only in obfuscation, not in improved shortness. But in the rle compressed version I could expand the Type's world immensely without a lot of size penalty. So now Type has a big and even nearly two dimensional sea to swim while paying only 19 additional bytes. So it should be clear why type waggles it tail ;) cheers, Brian -- Brian Schr�der http://www.brian-schroeder.de/