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

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



On Sat, Feb 17, 2001 at 10:36:10PM -0500, John Porter wrote:
> 
> In my solution, posted ealier,  I shuffle the deck and then
> do a 1-card distributive deal (like real life).  I thought
> I'd simply divide the shuffled deck in four chunks, but it
> turned out a deal was simpler.  
> But here's a different idea (maybe abigail can analyze it):
> 
> 	while (@deck) { # not shuffled
> 		push @{$hand{($h++)&3}, shift $deck[rand $#deck];
> 	}

That doesn't make much sense to me. shift takes an array as argument,
not a scalar. Perhaps you mean:

        push@{$hand{($h++)&3},splice@deck,rand@deck,1 while@deck;

which is just a shuffle and a deal zipped together.

Abigail

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