Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local term = require("term")
- local math = require("math")
- function doX(x, f)
- i = 0
- while i<x do
- f()
- i = i+1
- end
- end
- function forward()
- robot.swing()
- while not robot.forward() do
- robot.swing()
- os.sleep(0.2)
- end
- end
- print("Länge: ")
- local length = tonumber(term.read())-1
- print("Breite: ")
- local width = tonumber(term.read())
- print("Höhe: ")
- local height = tonumber(term.read())
- local s1 = true
- for y=1,height,1 do
- for z=1,width,1 do
- for x=1,length,1 do
- forward()
- end
- if z~=width then
- if s1 then
- robot.turnRight()
- forward()
- robot.turnRight()
- else
- robot.turnLeft()
- forward()
- robot.turnLeft()
- end
- s1 = not s1
- end
- end
- if y~=height then
- if math.fmod(width, 2)==0 then
- for i=1,length,1 do robot.back() end
- else
- robot.turnLeft()
- robot.turnLeft()
- end
- robot.swingDown()
- robot.down()
- s1 = true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement