• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bridge anyone? [not off topic]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bridge anyone? [not off topic]


  • Subject: Re: Bridge anyone? [not off topic]
  • From: Martin Orpen <email@hidden>
  • Date: Tue, 02 Nov 2004 17:56:58 +0000

Title: Re: Bridge anyone? [not off topic]
on 2/11/04 9:47 am, Bill wrote:

> Michelle,
>
> May I suggest a unicode version of cards ;)
>
> -- black spade, white heart, white diamond & black club
> set suit1 to {«data utxt2660», «data utxt2661», «data utxt2662», «data
> utxt2663»}


Yeah, pictures!

This is messy (especially the “try” bit) but it works pretty quickly and nearly sorts the cards too:


set
theSuit to {«data utxt2660», «data utxt2661», «data utxt2662», «data utxt2663»}
set
theValue to {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"}

set
theList to {}
set
theRef to a reference to theList
set x to ""
repeat until number of items in
theList is equal to 52
   set
x to (some item of theValue) & (some item of theSuit as Unicode text)
    
if
theRef does not contain x then
       set end of
theList to x
   end if
end
repeat

set {
North, East, South, West} to {{"-North:"}, {"-East:"}, {"-South:"}, {"-West:"}}
try
   repeat until number of items in
theList is 0
       set end of
North to item 1 of theList
       set theList to items 2 thru (count of items in theList) of theList
       set end of East to item 1 of theList
       set theList to items 2 thru (count of items in theList) of theList
       set end of South to item 1 of theList
       set theList to items 2 thru (count of items in theList) of theList
       set end of West to item 1 of theList
       set theList to items 2 thru (count of items in theList) of theList
   end repeat
end
try

sortHand(North) & return & sortHand(South) & return & sortHand(East) & return & sortHand(West)

on sortHand(x)
    
set AppleScript's text item delimiters to "\n"
    
set
x to do shell script "echo " & quoted form of (x as string) & " | sort -n"
    
return
x
end sortHand


--
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

  • Follow-Ups:
    • Re: Bridge anyone? [not off topic]
      • From: "Adam K. Wuellner" <email@hidden>
References: 
 >Re: Bridge anyone? [not off topic] (From: Bill <email@hidden>)

  • Prev by Date: Re: OmniGraffle - Insert Image
  • Next by Date: issues creating account in OS X Mail
  • Previous by thread: Re: Bridge anyone? [not off topic]
  • Next by thread: Re: Bridge anyone? [not off topic]
  • Index(es):
    • Date
    • Thread