Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- math.randomseed(os.time())
- rn = math.random(-100,100) --rn = random number
- player = {}
- player.guess = 0
- print(rn)
- while (player.guess ~= number) do
- print("Guess a number between -100 and 100")
- player.answer = io.read()
- player.guess = tonumber(player.answer)
- if (player.guess > number) then
- print("Lower")
- elseif (player.guess < number) then
- print("Higher")
- else
- print("YOU WON!!!")
- os.exit()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement