Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function determine_position()
- print("Enter the turtle's current coordinates (make sure the turtle is facing NORTH)")
- term.write("X:")
- x = read()
- term.write("Y:")
- y = read()
- term.write("Z:")
- z = read()
- end
- function strafe(direction)
- if direction == "right" then
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- elseif direction == "left" then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end
- end
- function move_to_position(ex,ey,ez)
- --moving on y axis first
- if y > ey then
- turtle.down()
- y = y - 1
- elseif y < ey then
- turtle.up()
- y = y + 1
- end
- --moving on x axis second
- if y == ey then
- if x > ex then
- strafe("left")
- x = x - 1
- elseif x < ex then
- strafe("right")
- x = x + 1
- end
- print(x)
- end
- --moving on z axis third
- if z == ez then
- if z > ez then
- turtle.forward()
- z = z - 1
- elseif z < ez then
- turtle.back()
- z = z + 1
- end
- end
- end
- x = -2111
- y = 10
- z = -99
- v = true
- while v do
- move_to_position(-2091,4,-99)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement