Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Random Math V0.1")
- ::diff::
- print("")
- print("What difficulty?")
- print("easy medium hard")
- gd = 0 dif = io.read()
- if dif == "easy" then
- lives = 3
- ran1 = 1
- ran2 = 2
- elseif dif == "medium" then
- lives = 2
- ran1 = 1
- ran2 = 3
- elseif dif == "hard" then
- lives = 1
- ran1 = 1
- ran2 = 3.5
- else
- os.execute("cls")
- print("invalid response")
- goto diff
- end
- os.execute("cls")
- rnd = 1
- while lives > 0 do
- mult = 0.75+(rnd * 0.25)
- mult = math.floor(mult)
- num1 = math.random(ran1 * mult, ran2 * mult)
- num2 = math.random(ran1 * mult, ran2 * mult)
- if rnd >= 20 then
- asmd = math.random(1,4)
- elseif rnd >= 10
- then asmd = math.random(1,3)
- elseif rnd >= 5 then
- asmd = math.random(1,2)
- else
- asmd = 1
- end
- if asmd == 1 then
- ans = num1 + num2
- print("What is "..num1.." + "..num2.."?")
- pa = io.read()
- if pa == ans then
- print("Correct!")
- rnd = rnd + 1
- else
- print("Wrong")
- print("Correct answer was "..ans)
- print("Your answer was "..pa)
- lives = lives - 1
- print("You now have "..lives.." lives")
- end
- elseif asmd == 2 then
- elseif asmd == 3 then
- else
- end
- end
- print("Game Over")
- print("You Lost to Round "..rnd)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement