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 11:01:37 +0000
Title: Re: Bridge anyone? [not off topic]
on 4/11/04 7:53 am, Graff wrote:
> Heh, I thought of writing a small executable in C to do just this but I
> dismissed the idea as cheating. :-)
Well, I guess it is *cheating* in this context - but useful if you need to disorder a list quickly.
Just a quick thought - isn't this sort of thing closer to the actual process of shuffling a real deck of cards?
set thePack 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", ¬
"AD", "KD", "QD", "JD", "10D", "9D", "8D", "7D", "6D", "5D", "4D", "3D", "2D", ¬
"AC", "KC", "QC", "JC", "10C", "9C", "8C", "7C", "6C", "5C", "4C", "3C", "2C"}
set theDeck to a reference to thePack
set shuffDeck to shuffle(theDeck)
repeat 6 times
set shuffDeck to shuffle(shuffDeck)
end repeat
shuffDeck
on shuffle(theDeck)
set newDeck to {}
repeat with x in theDeck
set r to random number from 1 to 2
if r is equal to 1 then
set end of newDeck to contents of x
else
set beginning of newDeck to contents of x
end if
end repeat
return newDeck
end shuffle
There must be a quicker way of doing the if/else bit, but I can’t think of it at the moment :-\
Regards
--
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