Scrabble anyone? [it's Friday]
Scrabble anyone? [it's Friday]
- Subject: Scrabble anyone? [it's Friday]
- From: Martin Orpen <email@hidden>
- Date: Fri, 05 Nov 2004 11:41:11 +0000
Title: Scrabble anyone? [it's Friday]
My scramble handler for shuffling cards got me to thinking about another application:
-- Scrabble practice...
set myList to do shell script "awk 'length == 7' /usr/share/dict/words | tr \"A-Z\" \"a-z\""
set myWord to some paragraph of myList
set theTest to scramble(myWord)
repeat 3 times
set theTest to scramble(theTest)
end repeat
set myGuess to (text returned of (display dialog "What word is this: " & theTest & return default answer ""))
if myGuess is equal to myWord then
display dialog "Congratulations!" & return & myWord & " was the correct answer"
else
display dialog "Sorry, the correct answer was: " & myWord
end if
on scramble(x)
set newWord to {}
repeat with i in text items of x as string
if some item of {true, false} then
set end of newWord to contents of i
else
set beginning of newWord to contents of i
end if
end repeat
return newWord as string
end scramble
Damn there are some difficult words in that list :-(
--
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