in reply to LOGO Japhing

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.

Replies are listed 'Best First'.
Re: Re: LOGO Japhing
by clintp (Curate) on Jul 03, 2001 at 16:44 UTC
    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....)