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

Re: [FWP] Perl Card Games



Uri wrote:
> 
> 	13,4R52?52
> 
> R is rho, the matrix size and reshape operator. this dealt a 52 card
> hand (? is the random and deal operator) and reshaped it to 4 hands of
> 13 cards. 

Does it actually *deal*?

If the randomization is good, you don't need to deal; so you can do this
in perl:

	$hands[$_] = splice @shuffled, 0, 13 for 0..3;

But if you want a real deal:

	$hands[$_%4][$_/4] = $shuffled[$_] for 0 .. 51;

John Porter


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