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

Re: [FWP] Perl Card Games



>>>>> "MU" == Mike Upmalis <mupmalis@i-com.com> writes:

  MU> You can also purposely generate bad shuffles. If a hand is passed
  MU> out, you stack the four hands after people sort them into suits,
  MU> cut, and then deal 4-4-4-4, 5-5-5-5, 4-4-4-4. It is a goulash, or
  MU> hungarian goulash deal.

we did that in my college bridge playing days. only if all of us passed
and we had sorted our hands. it usually made for a wild distribution
deal.

on a side note, i wrote (while in high school) an apl program to not
only deal a bridge hand but print it in the nice format you see the the
syndicated columns. very hard when apl doesn't allow 2-d arrays with varying
length rows. i think it does now but i will stick with perl. but apl
could do a shuffle and deal 4 hands with 1 expression (very bad memory
coming up and probably broken code):

	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. apl blows away perl for terseness!

i have also written a small set of subs (in perl, not apl!) that do
random set generation and the like for test data for sorts. would anyone
like to see them?

  MU> Call it a human factor.  By the way, you only need 7 good shuffles to
  MU> maximize randomness. I can supply the source, but it sticks in my memory.

and i believe 8 perfect riffle shuffles (alternating cards from each
half) in a row will leave the deck untouched! an old card trick if you
can do them perfectly.

<just joined this list in the middle of this thread>

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.

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