-- Rock-Paper-Scissors -- finished version. -- Run with: lua projects/rock-paper-scissors/finished.lua io.write("Choose rock, paper, or scissors: ") local player = io.read() -- the computer picks one of three at random, without a table local roll = math.random(1, 3) local computer if roll == 1 then computer = "rock" elseif roll == 2 then computer = "paper" else computer = "scissors" end print("The computer chose " .. computer .. ".") if player ~= "rock" and player ~= "paper" and player ~= "scissors" then print("That is not a valid choice.") elseif player == computer then print("It is a tie!") elseif (player == "rock" and computer == "scissors") or (player == "paper" and computer == "rock") or (player == "scissors" and computer == "paper") then print("You win!") else print("You lose!") end