Re: Bridge anyone? [not off topic]
Re: Bridge anyone? [not off topic]
- Subject: Re: Bridge anyone? [not off topic]
- From: Martin Orpen <email@hidden>
- Date: Thu, 04 Nov 2004 01:35:23 +0000
Title: Re: Bridge anyone? [not off topic]
on 3/11/04 4:21 pm, email@hidden wrote:
> 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.
Take a look at the source code here:
http://www.fuldix.westfalen.de/roland/software/shuffle/shuffle.tar.gz
Compile it and run it like this for example:
set theList to "AS KS QS JS 10S 9S 8S 7S 6S 5S 4S 3S 2S ¬
AH KH QH JH 10H 9H 8H 7H 6H 5H 4H 3H 2H ¬
AC KC QC JC 10C 9C 8C 7C 6C 5C 4C 3C 2C ¬
AD KD QD JD 10D 9D 8D 7D 6D 5D 4D 3D 2D"
set thePath to "/Path/to/Shuffle/Folder"
set theResult to do shell script "cd " & quoted form of thePath & "; ./shuffle " & theList
set theHands to {words 1 thru 13 of theResult, words 14 thru 26 of theResult, ¬
words 27 thru 40 of theResult, words 40 thru 52 of theResult}
And it should return all four hands in about a tenth of a second.
--
Martin Orpen
Idea Digital Imaging Ltd -- The Image Specialists
http://www.idea-digital.com
_______________________________________________
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