Not too surprisingly, my scores in this little game are inversely proportional to my consumption of ale. Just starting it and holding down ‘Enter’ while it runs will miss 2/3 of the tries, with what is the best possible time on the hits on your machine.
-- Uses the GetMilliSec osax found at http://osaxen.com/files/getmillisec1.0.1.html
-- If you don't have it, you can download it immediately at the URL below
-- http://files.macscripter.net/Osax2/Finder-System/getmillisecosax1.0.1.sit
-- Then put the uncompressed file in your ~/Library/ScriptingAdditions/ folder.
property wrongs : {"Oops", "Gotcha", "Bletch", "Slithy Tove", "Charisma", "Nope", "You wish", "Too Bad", "Not Here", "No Click"}
property rights : {"Click Here", "This One", "Yes Here", "You've Got It", "Please Click", "Yes Indeed"}
property orders : {{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}
property DfltBttn : {1, 2, 3}
set {total, teetotal, drat, keepGoing} to {0, 0, 0, true}
repeat while keepGoing is true
set tButtons to getButtons()
set strtTime to GetMilliSec
set btnClked to button returned of ¬
(display dialog "Let's see how fast you are..." buttons tButtons ¬
default button (some item of DfltBttn))
set clkTime to GetMilliSec
if rights contains btnClked then
set rspnsTime to (clkTime - strtTime)
set total to total + 1
set teetotal to teetotal + rspnsTime
set keepGoing to getChoice((rspnsTime / 1000 as string) & " seconds")
else
set drat to drat + 1
set keepGoing to getChoice("Oops, you missed!")
end if
end repeat
if drat ≠0 then
set msg to "but you missed " & drat & " out of " & total & " tries."
else
set msg to "without a miss. The buttons didn't fool you!"
end if
set avg to teetotal / total div 10
display dialog "You averaged " & avg / 100 & " seconds per click" & return & return & msg
to getChoice(status)
if button returned of (display dialog status & ¬
" seconds" buttons {"I Quit", "Again"} default button "Again") = "Again" then
return true
else
return false
end if
return keepGoing
end getChoice
to getButtons()
set vars to {some item of wrongs, some item of wrongs, some item of rights}
set tOrder to some item of orders
set Btn to {}
repeat with aNum in tOrder
set end of Btn to item aNum in vars
end repeat
return Btn
end getButtons