Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local nav = component.navigation
- local r = require("robot")
- local move=require("component").robot.move
- local sides = require("sides")
- local x, y, z=nav.getPosition()
- local newX=io.read()
- local newZ=io.read()
- print(nav.getPosition())
- print(nav.getFacing())
- print(x..y..z)
- while tonumber(newX)~=x do
- x,y,z=nav.getPosition()
- print(x..y..z)
- if tonumber(newX) > x then
- move(sides.left)
- else
- move(sides.right)
- end
- end
- while tonumber(newZ) ~= z do
- x,y,z=nav.getPosition()
- print(x..y..z)
- if tonumber(newZ) > z then
- r.forward()
- else
- r.back()
- end
- end
- print(nav.getPosition())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement