Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- do
- vers = "v0.4.3"
- game = "Solve the Anagram!"
- seed = math.random(1,3)
- anagram = nil
- answer = nil
- win = false
- tries = 1
- end
- -- Introduction --
- textutils.slowPrint("-----------------0-----------------")
- print("Welcome to "..game.." "..vers)
- textutils.slowPrint("-----------------0-----------------")
- print("What's your name?")
- local name = read()
- print("The computer will present a jumbled set of letters.")
- print("Your job is to rearrange those letters and " ..game)
- -- Seed --
- while true do
- if seed == 1 then
- anagram = "mrranga"
- answer = "anagram"
- textutils.slowPrint("Your anagram to solve is "..anagram)
- break
- elseif seed == 2 then
- anagram = "ginamrei"
- answer = "migraine"
- textutils.slowPrint("Your anagram to solve is "..anagram)
- break
- elseif seed == 3 then
- anagram = "rltntuensac"
- answer = "translucent"
- textutils.slowPrint("Your anagram to solve is "..anagram)
- break
- end
- end
- -- Main game loop --
- while true do
- guess = io.read()
- if guess == answer then
- win = true
- break
- else
- print("Incorrect! Try again.")
- end
- tries = tries + 1
- end
- -- Outro --
- do
- if win == true then
- term.clear()
- print("CONGRATULATIONS!")
- textutils.slowPrint("The answer was " ..answer..".")
- textutils.slowPrint("Thank you for playing " ..game.." "..vers)
- if tries == 1 then
- print("You took 1 try to find the answer. Awesome!")
- else
- print("You took "..tries.." tries to find the answer.")
- end
- if name == " " then
- textutils.slowPrint("See you later!")
- else
- textutils.slowPrint("See you later, "..name.."!")
- end
- end
- -- Answers --
- -- anagram
- -- mraanga
- -- migraine
- -- ginamrei
- -- translucent
- -- rltntuensac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement