Re: Bridge anyone? [not off topic]
Re: Bridge anyone? [not off topic]
- Subject: Re: Bridge anyone? [not off topic]
- From: Nigel Garvey <email@hidden>
- Date: Thu, 4 Nov 2004 00:16:32 +0000
email@hidden wrote on Wed, 3 Nov 2004 11:21:27 -0500:
>The idea is, rather than deciding on a random card from the deck and
>dealing the hands in order, instead deal from the sorted deck, but
>choose randomly which hand to deal to for each card. Once a hand has
>13 cards, omit that hand from further consideration.
It did turn out to be a very fast process. I'm no great mathematician or
statistician, but my instinct is to go with those who have reservations
about this method. Starting with an ordered deck and gradually
eliminating hands from the deal increases the likelihood that the last
one's going to end up with a run of clubs.
The script I posted this morning (GMT) is even faster than Bernard's on
my machine and "shuffles" the entire deck.
>I'm pretty sure there's an even better algorithm. I know standard
>card deck dealers use some kind of hash encoding of a single number
>to represent a whole hand. I'm guessing that the char-math that
>normally accompanies that kind of encoding won't fly easily in
>applescript. There are also issues in that 32-bits (standard
>integer) isn't enough to encode all possible bridge hands, so some
>dealers settle for a subset of possible hands that has sufficient
>range, rather than dealing with bignums.
Well, I suppose adding powers of 2 to a hand would be faster than adding
items to a list, but then you have to decode the hand.... :-)
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden