Advertisement
Guest User

Indent error in Turing

a guest
Mar 9th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. loop
  2. % var Font : int
  3. % Font := Font.New ("courier :10")
  4. % Font.Draw ("Guess the Number!", 10, 475, Font, black)
  5. % Draw.Box (5, 468, 215, 497, black)
  6.  
  7. var l : int := Rand.Int (1, limit) % Generates the number that the user is trying to guess
  8. Text.Locate (5, 1)
  9. put "Guess the number! It's between 1 and 100."
  10. loop
  11. loop
  12. get input
  13. if strintok (input) then
  14. z := strint (input)
  15. exit
  16. else
  17. put "That's not a number!"
  18. delay (1000)
  19. clearall
  20. Text.Locate (5, 1)
  21. put "Guess the number! It's between 1 and 100."
  22. end if
  23. end loop
  24. if z = l then
  25. put "Congratulations! You guessed correctly!"
  26. exit
  27. else if z > l then
  28. put "Try guessing lower. Keep on going."
  29. else if z < l then
  30. put "Try guessing higher. Keep on going."
  31. end if
  32. put "It took you " ..
  33. put counter ..
  34. put " guesses to guess the correct number!"
  35. if counter = 1 then
  36. put "Start buying lottery tickets!"
  37. else if counter <= 3 then
  38. put "You are an AI!"
  39. else if counter <= 6 then
  40. put "Great guessing! Move up to the next level to challenge yourself."
  41. else if counter <= 10 then
  42. put "Try guessing the number faster next time."
  43. else if counter >= 10 then
  44. put "Use better guessing strategies next time."
  45. end if
  46. end loop
  47. delay (1000)
  48. put ""
  49. put "Want to play the guessing game again? y/n"
  50. get yesorno
  51. if yesorno = "n" then % if user chooses not to play again
  52. put ""
  53. put "You have decided to quit, Peace!"
  54. delay (1000)
  55. exit
  56. else if yesorno = "y" then % if user chooses to play again
  57. put ""
  58. put "You have chosen to play again!"
  59. delay (1000)
  60. clearall
  61. else % Will make user play again if they do not enter either a 'y' or a 'n
  62. put ""
  63. put "Assuming that as play again"
  64. delay (1000)
  65. clearall
  66. end if
  67. end loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement