Advertisement
Guest User

Untitled

a guest
May 25th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. function getStart(checkStart)
  2. local start = " "
  3. term.write("DO you think you are worthy to enter? Y/N: ")
  4. start = read()
  5. if start ~=checkStart then
  6. print("Fine")
  7. return false
  8. else
  9. print("Let's Begin the game.")
  10. return true
  11. end
  12. end
  13.  
  14. local computerChoice = math.random(0,100)
  15. if computerChoice <= 33 then
  16. computerChoice= "Rock"
  17. else if computerChoice >= 67 then
  18. computerChoice = "Scissors"
  19. else computerChoice = "Paper"
  20. end
  21. end
  22.  
  23. function userChoice(checkChoice)
  24. local user = " "
  25. term.write("Rock, Paper, or Scissors?: ")
  26. user = read()
  27. if not userChoice("rock") then
  28. userChoice("Scissors")
  29. else userChoice("Paper")
  30. if user = checkChoice then
  31. print("Wrong Answer.")
  32. return false
  33. else if user == "rock" then
  34. print("You chose rock. The computer chose: " ..computerChoice)
  35. return true
  36. else if user == "scissors" then
  37. print("You chose scissors. The computer chose: " ..computerChoice)
  38. return true
  39. else if user == "paper" then
  40. print("You chose paper. The computer chose: " ..computerChoice)
  41. return true
  42. else print("Not a valid answer.")
  43. return false
  44. end
  45. end
  46. end
  47. end
  48. end
  49. end
  50.  
  51.  
  52. if not userChoice("rock") then
  53. userChoice("Scissors")
  54. else userChoice("Paper")
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement