Bridge anyone? [not off topic]
Bridge anyone? [not off topic]
- Subject: Bridge anyone? [not off topic]
- From: Michelle Steiner <email@hidden>
- Date: Mon, 1 Nov 2004 14:16:57 -0700
Any way to increase the efficiency of this script that deals out a
bridge (or spades, or hearts, etc.) hand?
set the pack to {}
set the terminator to {}
set the cards 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 the hand to {{}, {}, {}, {}}
repeat with i from 1 to 52
copy i to the end of the pack
copy 0 to the end of the terminator
end repeat
repeat until the pack is the terminator
repeat with i from 1 to 4
repeat until (count of item i of the hand) is 13
set the card to some item of the pack
if the card is not 0 then
set item card of the pack to 0
tell the hand to copy (item card of the cards) to the end of item i
of the hand
end if
end repeat
end repeat
end repeat
set north to item 1 of the hand
set east to item 2 of the hand
set south to item 3 of the hand
set west to item 4 of the hand
--
"To announce that there must be no criticism of the president, or that
we are to stand by the president right or wrong, is not only
unpatriotic and servile, but is morally treasonable to the American
public." --Teddy Roosevelt
_______________________________________________
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