Guest User

cpucraft

a guest
May 28th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. do
  2. numb = math.random (1, 100)
  3. tries = 1
  4. triesmax = 4
  5. version = 1.2
  6. win = false
  7. end
  8.  
  9. do
  10.  
  11. term.clear()
  12. textutils.slowPrint ("---------------------------------")
  13. textutils.slowPrint ("Guess the Number (Hard) V " .. version )
  14. textutils.slowPrint ("---------------------------------")
  15. textutils.slowPrint ("Press enter to continue...")
  16. io.read()
  17. textutils.slowPrint ("You have 6 guesses. Guess the number before you run out of guesses.")
  18. end
  19.  
  20.  
  21. while true do
  22. if tries > triesmax then
  23. break
  24. else
  25. textutils.slowPrint ("The number is from [1 - 100, whole number]")
  26. guess = io.read()
  27. guess = tonumber (guess)
  28. if guess == numb then
  29. win = true
  30. break
  31. else
  32. textutils.slowPrint ("Incorrect")
  33. end
  34. end
  35. end
  36.  
  37.  
  38.  
  39.  
  40.  
  41. do
  42. term.clear()
  43. textutils.slowPrint ("GAME OVER")
  44. if win == true then
  45. textutils.slowPrint ("YOU WON!")
  46. else
  47. textutils.slowPrint ("NO ONE WON!")
  48. end
  49. textutils.slowPrint ("Thank you for playing, made by usef155")
  50. end
  51. textutils.slowPrint ("The number was " .. numb )
  52. end
  53. if tries == 1 then
  54. textutils.slowPrint ("Player 3 Won")
  55. elseif tries == 0 then
  56. textutils.slowPrint ("Player 4 Won")
  57. elseif tries == 3
  58. textutils.slowPrint ("Player 1 Won")
  59. elseif tries == 2
  60. textutils.slowPrint ("Player 2 Won")
  61. end
  62. end
Advertisement
Add Comment
Please, Sign In to add comment