Re: Scrabble anyone? [it's Friday]
Re: Scrabble anyone? [it's Friday]
- Subject: Re: Scrabble anyone? [it's Friday]
- From: Graff <email@hidden>
- Date: Fri, 05 Nov 2004 09:26:57 -0500
Heh, sounds a good start for a Hangman game. You should allow letter
guesses and slowly reveal a ASCII man being hanged:
_______
| |
|
|
|
|
_______
| |
| 0
|
|
|
|
_______
| |
| 0
| |
| |
|
|
_______
| |
| 0
| |
| |
| /
|
_______
| |
| 0
| |
| |
| / \
|
_______
| |
| 0
| __|
| |
| / \
|
_______
| |
| 0
| __|__
| |
| / \
|
- Ken
On Nov 5, 2004, at 6:41 AM, Martin Orpen wrote:
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
_______________________________________________
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