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

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



Rick Delaney <rick.delaney@home.com> wrote:

> Here's 198.  I'm sure it can be shortened/improved, but it's time for
> bed.
> 
> @s=qw/S H D C/;for$s(@s){$_='AKQJT98765432';for$i(4,3,2,1){my$c;s/./
> rand$i>1?$&:($c.=$&,"")/ge;($j,$f)=$i%2?($i,"%15s:%s"):(2,"%s:%-25s");
> $x[$j]{$s}.=sprintf$f,$s,$c}}$,=$\="\n";print@{$_}{@s}for@x;

Unfortunately the method of distributing cards is flawed. 
Randomly assigning each card to a player independently doesn't
ensure that each player ends up with 13 cards.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC

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