On Fri, Feb 16, 2001 at 03:42:08PM +0000, Ian Phillipps wrote: > The topic of APL came up today, and I recalled an APL one-liner (about > 150 chars if I recall) that printed a set of 4 Bridge hands in the > conventional layout. > > Having more laziness and impatience than hubris at the moment, I > wondered if fwpers would rise to the challenge of duplicating this > feat... #!/usr/bin/perl for$a(qw/S H D C/){push@d,map"$a$_",2..9,qw/a b c d e/}$_==($i=rand($_+1)) or@d[$_,$i]=@d[$i,$_]for 0..@d;sub h{$_=join ',',reverse sort splice@d,0,13 ;1 while s/(.)(.*?,)\1/$1$2/g;s/(\w)(\w)/\n$1: $2/g;y/edcba,/AKQJT/d;$_}$t= ' 'x13;push@hands,map{s/\n/\n$t/g;$_}h()for 0..1;@t=split/\n/,h()."\n".h(); $hands[2].=sprintf"%-23s%s\n",@t[$_,$_+5]for 0..4;print join"\n",@hands[0,2 ,1]; __END__ Joy, Yanick ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe