Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getStart(checkStart)
- local start = " "
- term.write("DO you think you are worthy to enter? Y/N: ")
- start = read()
- if start ~=checkStart then
- print("Fine")
- return false
- else
- print("Let's Begin the game.")
- return true
- end
- end
- local computerChoice = math.random(0,100)
- if computerChoice <= 33 then
- computerChoice= "Rock"
- else if computerChoice >= 67 then
- computerChoice = "Scissors"
- else computerChoice = "Paper"
- end
- end
- function userChoice(checkChoice)
- local user = " "
- term.write("Rock, Paper, or Scissors?: ")
- user = read()
- if not userChoice("rock") then
- userChoice("Scissors")
- else userChoice("Paper")
- if user = checkChoice then
- print("Wrong Answer.")
- return false
- else if user == "rock" then
- print("You chose rock. The computer chose: " ..computerChoice)
- return true
- else if user == "scissors" then
- print("You chose scissors. The computer chose: " ..computerChoice)
- return true
- else if user == "paper" then
- print("You chose paper. The computer chose: " ..computerChoice)
- return true
- else print("Not a valid answer.")
- return false
- end
- end
- end
- end
- end
- end
- if not userChoice("rock") then
- userChoice("Scissors")
- else userChoice("Paper")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement