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

Re: [FWP] APL vs. Perl. A query from a lazy programmer.



Ian Phillipps wrote:
> 

hmmm.. forgot the code...

Assuming we must shuffle, deal, and layout the cards.
I'm not a bridge player, so I just guessed what should
happen if a suit is void.

#!/usr/bin/perl
@y=(10,5,5,0);@d=map$_->[0],sort{$a->[1]<=>$b->[1]}map[$_,rand],0..51;@l=(
' 'x70 ."\n")x14;for$x(20,1,40,20){$y=pop@y;$h=join'',map{(qw/S H D C/)[$_
/13].substr'AKQJT98765432',$_%13,1}sort{$a<=>$b}splice@d,0,13;1while$h=~
s/([SHDC])(.*)\1/$1$2/;substr$l[$y++],$x,0,"$1: $2"while$h=~
/([SHDC])([^SHDC]+)/g}print@l;

-- 
Rick Klement

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