SHOW:
|
|
- or go back to the newest paste.
| 1 | --MathTest Shell Modification | |
| 2 | --Running any program requires a multiplication problem to be solved | |
| 3 | --By minimite for ComputerCraft, a minecraft mod that introduces computers for Minecraft | |
| 4 | - | print("What is "..q1.."+"..q2.."?")
|
| 4 | + | |
| 5 | - | local answer = q1+q2 |
| 5 | + | shell.oldrun = shell.run |
| 6 | ||
| 7 | function shell.run(program, ...) | |
| 8 | local q1 = math.random(1,100) | |
| 9 | local q2 = math.random(1,100) | |
| 10 | - | print("WRONG!")
|
| 10 | + | write("What is "..q1.."*"..q2.."? ")
|
| 11 | local answer = q1*q2 | |
| 12 | local uans = tonumber(read()) | |
| 13 | if uans == answer then | |
| 14 | shell.oldrun(program, ...) | |
| 15 | else | |
| 16 | print("WRONG! Try again!")
| |
| 17 | end | |
| 18 | end |