Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local computer = require("computer")
- local robot = require("robot")
- local component = require("component")
- local sides = require("sides")
- local redstone = component.redstone
- local term = require("term")
- io.write("how many % to win:")
- x = io.read()
- if x ~= 0 then
- ver = 100 / x
- elseif x == 0 then
- ver = 0
- end
- function scan()
- redstone.setOutput(sides.back,0)
- alm = robot.compareTo(16)
- co = robot.count()
- robot.suck()
- if alm == true and co > 0 and ver ~= 0 then
- robot.dropDown()
- rand = math.random(ver)
- print(rand)
- if rand == 1 then
- redstone.setOutput(sides.back,15)
- os.sleep(1)
- redstone.setOutput(sides.back,0)
- elseif rand ~= 1 then
- computer.beep(2000, 0.7)
- elseif alm == true and co > 0 and ver == 0 then
- robot.dropDown()
- rand = 0
- print(rand)
- computer.beep(2000, 0.7)
- end
- end
- end
- while true do
- red = redstone.getInput(sides.right)
- if red > 0 then
- scan()
- end
- --end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement