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!
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.#!/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__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LOGO Japhing
by Anonymous Monk on Jul 03, 2001 at 15:14 UTC | |
by clintp (Curate) on Jul 03, 2001 at 16:44 UTC | |
by bschmer (Friar) on Jul 03, 2001 at 18:19 UTC |