Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local robot = require("robot")
- local term = require("term")
- term.clear()
- term.setCursor(1,1)
- term.write("wie weit nach vorne?\nvorne: ")
- local front = tonumber(term.read())
- term.write("wie weit nach rechts?\nrechts: ")
- local side = tonumber(term.read())
- term.write("wie hoch?\nhöhe: ")
- local height = tonumber(term.read())
- local slot = 1
- function reload()
- if slot ~= 15 then
- slot = slot+1
- else
- error("Keine Blöcke mehr vorhanden!")
- end
- robot.select(slot)
- end
- function check(up, down)
- if down == true then
- if robot.compareDown(16) == false then
- robot.swingDown()
- if robot.space() == 64 then
- reload()
- end
- robot.placeDown()
- end
- end
- if up == true then
- if robot.compareUp(16) == false then
- robot.swingUp()
- if robot.space() == 64 then
- reload()
- end
- robot.placeUp()
- end
- end
- _,str = robot.detect()
- if str ~= "air" then
- robot.swing()
- end
- end
- local direction = "right"
- for h=0,height do
- if h==height then up = true else up = false end
- if h==0 then down = true else down = false end
- for y=0,side do
- for x=0,front do
- check(up,down)
- robot.forward()
- end
- if direction == "right" then
- robot.turnRight()
- if y~=side then
- check(up,down)
- robot.forward()
- end
- robot.turnRight()
- direction = "left"
- else
- robot.turnLeft()
- if y~=side then
- check(up,down)
- robot.forward()
- end
- robot.turnLeft()
- direction = "right"
- end
- end
- robot.swingUp()
- robot.up()
- if direction == "right" then
- direction = "left"
- else
- direction = "right"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement