Created
June 28, 2012 07:31
-
-
Save epetousis/3009687 to your computer and use it in GitHub Desktop.
A game written in AppleScript where you have to choose the name of a random angle.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set score to 0 | |
repeat 10 times | |
set angleno to random number from 1 to 360 | |
set angleans to (choose from list {"Acute", "Right", "Obtuse", "Straight", "Reflex", "Revolution"} with prompt "My angle is " & angleno & "˚. What am I?") as string | |
if 1 ≤ angleno and angleno ≤ 89 then | |
if angleans is "Acute" then | |
set score to score + 1 | |
display dialog "Correct! Your score is " & score & "." buttons {"OK", "Quit"} cancel button 2 | |
else | |
display dialog "Incorrect! The correct name is an acute angle." buttons {"OK", "Quit"} cancel button 2 | |
end if | |
end if | |
if angleno is 90 then | |
if angleans is "Right" then | |
set score to score + 1 | |
display dialog "Correct! Your score is " & score & "." buttons {"OK", "Quit"} cancel button 2 | |
else | |
display dialog "Incorrect! The correct name is a right angle." buttons {"OK", "Quit"} cancel button 2 | |
end if | |
end if | |
if 91 ≤ angleno and angleno ≤ 179 then | |
if angleans is "Obtuse" then | |
set score to score + 1 | |
display dialog "Correct! Your score is " & score & "." buttons {"OK", "Quit"} cancel button 2 | |
else | |
display dialog "Incorrect! The correct name is an obtuse angle." buttons {"OK", "Quit"} cancel button 2 | |
end if | |
end if | |
if angleno is 180 then | |
if angleans is "Straight" then | |
set score to score + 1 | |
display dialog "Correct! Your score is " & score & "." buttons {"OK", "Quit"} cancel button 2 | |
else | |
display dialog "Incorrect! The correct name is a straight angle." buttons {"OK", "Quit"} cancel button 2 | |
end if | |
end if | |
if 181 ≤ angleno and angleno ≤ 359 then | |
if angleans is "Reflex" then | |
set score to score + 1 | |
display dialog "Correct! Your score is " & score & "." buttons {"OK", "Quit"} cancel button 2 | |
else | |
display dialog "Incorrect! The correct name is a right angle." buttons {"OK", "Quit"} cancel button 2 | |
end if | |
end if | |
if angleno is 360 then | |
if angleans is "Revolution" then | |
set score to score + 1 | |
display dialog "Correct! Your score is " & score & "." buttons {"OK", "Quit"} cancel button 2 | |
else | |
display dialog "Incorrect! The correct name is a revolution." buttons {"OK", "Quit"} cancel button 2 | |
end if | |
end if | |
end repeat | |
if 0 ≤ score and score ≤ 4 then | |
display dialog "You got " & score & " out of 10. Better luck next time!" buttons {"OK"} | |
else | |
display dialog "You got " & score & " out of 10. Well done!" buttons {"OK"} | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment