Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local r = require("robot")
- local component = require("component")
- local ge = component.geolyzer
- local x = 1
- local y = 1
- local z = 1
- local yh = 1
- local g = component.generator
- function xup()
- while x < 41 do
- if r.swing() == true then
- repeat
- r.swing()
- until r.swing() == false
- else
- if r.forward() == true then
- x = x+1
- end
- end
- end
- end
- function xdown()
- while x > 1 do
- if r.swing() == true then
- repeat
- r.swing()
- until r.swing() == false
- else
- if r.forward() == true then
- x = x-1
- end
- end
- end
- end
- function yup()
- while yh < 4 do
- if r.swing() == true then
- repeat
- print("dig")
- r.swing()
- until r.swing() == false
- else
- if r.forward() == true then
- yh = yh+1
- y = y+1
- print("y=")
- print(y)
- print("yh=")
- print(yh)
- end
- end
- end
- yh = 1
- print("y=")
- print(y)
- print("yh=")
- print(yh)
- end
- -- program main
- while y < 41 do
- xup()
- r.turnRight()
- yup()
- r.turnRight()
- xdown()
- r.tutnLeft()
- yup()
- r.turnLeft()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement