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

Re: [FWP] Golf: chessboard



"Keith Calvert Ivey" <kcivey@cpcug.org> writes:

> The challenge is to write a Perl program with the fewest
> characters (the shebang line doesn't count) that takes as a
> command-line argument a chess position in Forsythe-Edwards
> notation (FEN) and prints out an ASCII representation of a 
> chessboard like that produced by the Position->to_text() method 
> in Gareth Rees's Games::Chess module.

I'm sure there's a shorter way than this (91 characters):

#!/usr/bin/perl -l
$f=-1;$_=pop;y:/:\n:;s/\d/" "x$&/ge;s;.;$f++,$&eq" "?($f+$f/8)%2?". ":"  ":"$& ";ge;print

jason
-- 
``Just because one proposes a measure to prevent promotion
        of a risk-filled and controversial sexual behavior
                     doesn't make them divisive or bigoted.''
                                     -- Nicholas J. Yonker,
                    Concerned Citizens for Sound Education

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