[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, 17 Feb 2001 22:36:10 EST,
			      John Porter wrote:

:	while (@deck) { # not shuffled
:		push @{$hand{($h++)&3}, shift $deck[rand $#deck];
:	}

That shift wants to be a splice, and the $# wants to be a @, no?

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

Of course, at some tables you'd be shot for dealing from the middle
of the deck like that, but I think the principles are sound.

Michael

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