Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xp1,yp1,zp1 = gps.locate()
- print("veuillez entrer les coordonnes")
- write ("x: ")
- xd = read()
- write ("\ny: ")
- yd = read()
- write ("\nz: ")
- zd = read()
- x = xd - xp1
- y = yd - yp1
- z = zd - zp1
- if x < 0 then
- x = x * -1
- elseif y < 0 then
- y = y * -1
- elseif z < 0 then
- z = z * -1
- end
- -- voir dans quel sens est la tortue
- turtle.forward()
- local xp2,yp2,zp2 = gps.locate()
- if xd < xp1 then
- if xp1 > xp2 then
- x = x - 1
- elseif xp1 < xp2 then
- x = x+1
- turtle.turnRight()
- turtle.turnRight()
- elseif xp1 = xp2 and zp1 < zp2 then
- turtle.turnRight()
- z = z + 1
- elseif xp1 = xp2 and zp1 > zp2 then
- turtle.turnLeft()
- z = z - 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement