Hmmm... a japh-like idea I had when I was looking at a page-layout engine design at work. I didn't have time to obfuscate it really hard, and will take suggestions.

There's just a bit of mild obfuscation, a couple of odd syntax tricks, a few little-used Perl features. This is a straightforward one to take apart, and it's 5.6 clean. Enjoy!

#!/usr/bin/perl -w $s=2;($p)=@m=(0,0,1,0);$/=\1; sub t{@m[2,3]=(0,0);for$y(split//,$_[0]){for(2,3) { $m[$_]+={n=>[-1,0],s=>[1,0],e=>[0,1],w=>[0,-1]}->{$y}->[$_-2];}}} $SIG{__WARN__}=sub{$p=!$p};seek DATA,0,0; for (qw( 6 se p 2 e 2 ne 2 n 5 p e 2 s 8 p n 6 ne 2 e 1 se 2 s 5 n 2 w 4 e 4 p e 2 s 3 p n 8 e 4 se 1 s 2 sw 1 w 4 p se 4 e 3 p n 8 s 4 e 4 n 4 s 7 )) { $_[0]=$_;tr/nsew//?&t:&f} sub f{for(1..$_[0]*$s) {for(0,1){$m[$_]+=$m[$_+2]}if ($p){while(<DATA>){$t=$_;tr/\n\t //||last;}}$g[$m[0]][$m[1]]=$p?$t:" " +;}} for$i(0..20){for(0..60){print $g[$i][$_]||" ";}print"\n";} __END__
PS: Change the $s=2 to another positive integer to change the scale. The 20 and 60 may also have to be changed if you go large. You will have to run this from a file.

Replies are listed 'Best First'.
Re: LOGO Japhing
by Anonymous Monk on Jul 03, 2001 at 15:14 UTC
    Nice code. While playing around with different values of $s, I started losing the "H". At first I thought it was the way that I had modified the code to remove trailing whitespace and empty lines from the output. I then realized that the script was running out of DATA. I added the line "seek DATA, 0, 0 if eof(DATA)" after last; And since the seek is now used more than once, I created a subroutine to do that work. Here's my updated version:
    #!/usr/bin/perl -w ($s=pop)||($s=10);($p)=@m=(0,0,1,0);$/=\1; $r = sub {seek DATA,0,0};sub t{@m[2,3]=(0, 0);for$y(split//,$_[0]){for(2,3) {$m[$_]+= {n=>[-1,0],s=>[1,0],e=>[0,1],w=>[0,-1]}->{ $y}->[$_-2];}}}$SIG{__WARN__}=sub{$p=!$p}; &$r;for (qw( 6 se p 2 e 2 ne 2 n 5 p e 2 s 8 p n 6 ne 2 e 1 se 2 s 5 n 2 w 4 e 4 p e 2 s 3 p n 8 e 4 se 1 s 2 sw 1 w 4 p se 4 e 3 p n 8 s 4 e 4 n 4 s 7 )) {$_[0]=$_;tr/nsew//?&t:&f}sub f{for(1.. $_[0]*$s){for(0,1){$m[$_]+=$m[$_+2]}if ($p ){while(<DATA>){$t=$_;tr/\n\t //||last;&$r if eof(DATA);}}$g[$m[0]][$m[1]]=$p?$t:" "; }}for$i(0..($s*20)){$l = "";for(0..($s*30) ){$l.=$g[$i][$_]||" ";}$l=~ s/\s+$//;print "$l\n" if length($l);} __END__
    You can also pass $s in and the ranges aroung the prints should scale properly.
      Thank you for the changes! I really hadn't moved the scale to anywhere beyond 1, 2, and 3 (it was a long day, a long week and I really just wanted to go home).
        You're welcome. You need to make the font small in order to make the logo big which makes it harder to tell that you're using the source of the script to fill in the letters, but it still looks neat. I've had days, weeks, months and years like that (think 1999....)