Advertisement
jifi68

Untitled

Mar 1st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 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. end
  33. if "xp1 < xp2" then
  34. x = x+1
  35. turtle.turnRight()
  36. turtle.turnRight()
  37. end
  38. if "xp1 - xp2 = 0" and "zp1 < zp2" then
  39. turtle.turnRight()
  40. z = z + 1
  41. end
  42. if "xp1 = xp2" and "zp1 > zp2" then
  43. turtle.turnLeft()
  44. z = z - 1
  45. end
  46.  
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement