Advertisement
jifi68

Untitled

Mar 1st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. local xp1,yp1,zp1 = gps.locate()
  2.  
  3. print("veuillez entrer les coordonnes")
  4. write ("x: ")
  5. xd = read()
  6. write ("\ny: ")
  7. yd = read()
  8. write ("\nz: ")
  9. zd = read()
  10.  
  11. x = xd - xp1
  12. y = yd - yp1
  13. z = zd - zp1
  14.  
  15. if x < 0 then
  16. x = x * -1
  17. elseif y < 0 then
  18. y = y * -1
  19. elseif z < 0 then
  20. z = z * -1
  21. end
  22.  
  23. -- voir dans quel sens est la tortue
  24.  
  25. turtle.forward()
  26. local xp2,yp2,zp2 = gps.locate()
  27.  
  28. if xd < xp1 then
  29.  
  30. if xp1 > xp2 then
  31. x = x - 1
  32. elseif xp1 < xp2 then
  33. x = x+1
  34. turtle.turnRight()
  35. turtle.turnRight()
  36. elseif xp1 = xp2 and zp1 < zp2 then
  37. turtle.turnRight()
  38. z = z + 1
  39. elseif xp1 = xp2 and zp1 > zp2 then
  40. turtle.turnLeft()
  41. z = z - 1
  42. end
  43.  
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement