### Re: ASCII Pattern - Golf (Russ: 77)

by cLive ;-) (Prior)
 on Sep 19, 2003 at 03:52 UTC Need Help??

in reply to Re: Re: ASCII Pattern - Golf (Russ: 77)
in thread ASCII Pattern - Golf

74 :)
```\$i=9;do{print\$/,map{(sort abs\$_-\$ARGV[0],abs\$i-\$ARGV[1])[1]}1..9}while
+--\$i

Replies are listed 'Best First'.
Re: Re: ASCII Pattern - Golf (The Sidhekin: 70, or no, 69)
by Sidhekin (Priest) on Sep 19, 2003 at 22:56 UTC

A for-loop is usually shorter than a do{...}while-loop. 70 :-)

\$t=abs\$ARGV[1]+\$_,print\$/,map{(sort\$t,abs\$ARGV[0]-\$_)[1]}1..9for-9..-1

If you want the newlines "right", I end up at 72:

\$t=abs\$ARGV[1]+\$_,print map((sort\$t,abs\$ARGV[0]-\$_)[1],1..9),\$/for-9..-1

Update: Well, what do you know ... the string \$ARGV[1]+\$_ is longer than the strings (\$s=pop) and \$s taken together. Make those 69 and 71 (both with tie-breaker at 30 different characters):

\$t=abs,print\$/,map+(sort\$t,abs\$ARGV[0]-\$_)[1],1..9for(\$s=pop)-9..\$s-1

... and ...

\$t=abs,print map((sort\$t,abs\$ARGV[0]-\$_)[1],1..9),\$/for(\$s=pop)-9..\$s-1

The Sidhekin
print "Just another Perl \${\(trickster and hacker)},"

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://292577]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-02-26 21:10 GMT
Voting Booth?
My favourite way to spend a leap day ...

Results (26 votes). Check out past polls.