[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] Re: Golf: chessboard



In article <3AA26009.936F6DAE@pacbell.net>,
	Rick Klement <rklement@pacbell.net> writes:
> Ton Hospel wrote:
>> 
>> In article <20010304023104.57D18261BB@server3.safepages.com>,
>>         "Keith Calvert Ivey" <kcivey@cpcug.org> writes:
>> Ok, first attempt:
>> 
>> $_=pop;s/\d/$|x$&/eg;s/./--$|?$&||$":$&||"."/eg;y|/|\n|;print
> 
> Sorry Ton, that's out of bounds, quoting from the rules:
> "there are spaces between the columns".
> 
> Cool use of a toggling variable, though.
> 
> Mine's down to 65 characters:
> 
> #!/usr/bin/perl -l
> $_=pop;s/\d/$"x$&/eg;s/ (?=.(..)*$)/./g;s/./$& /g;s#/ #\n#g;print
> 
That's fixable at the price of extra spaces in front (64 chars):
#!/usr/bin/perl -l
$_=pop;s/\d/$|x$&/eg;s/./--$|||$&?" $&":" ."/eg;y|0/| \n|;print

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe