in reply to ASCII Pattern - Golf

Dropping the /usr/bin/perl line, this drops 12 strokes off your loop:
$x=shift;$y=10-shift;for$a(1..9){for(1..9){$c=abs$y-$a;$d=abs$x-$_;pri +nt$c>$d?$c:$d}print"\n"}

-Mark

Replies are listed 'Best First'.
Re: Re: ASCII Pattern - Golf
by tedrek (Pilgrim) on Sep 19, 2003 at 02:22 UTC
    And getting rid of the for loops appears to take another 10 strokes off.
    $x=shift;$z=10-shift;map{$t=abs$z-$_;print map($t>abs$x-$_?$t:abs$x-$_ +,1..9),$/;}0..9
      You can get 4 more with shift vs pop. + 1 for a useless ;.
      $z=10-pop;$x=pop;map{$t=abs$z-$_;print map($t>abs$x-$_?$t:abs$x-$_,1.. +9),$/}1..9
      (I also fixed a bug.)