Advertisement
Digitamz

Sucker v1

Jun 27th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. local function putItem(s)
  2. if s == "L" then
  3. turtle.turnRight()
  4. turtle.drop()
  5. turtle.turnLeft()
  6. elseif s == "R" then
  7. turtle.turnLeft()
  8. turtle.drop()
  9. turtle.turnRight()
  10. else
  11. turtle.turnLeft()
  12. turtle.turnLeft()
  13. turtle.drop()
  14. turtle.turnLeft()
  15. turtle.turnLeft()
  16. end
  17. end
  18.  
  19. local function decide(l, r)
  20. local arg = { ... }
  21. local l = arg[1]
  22. local r = arg[2]
  23. turtle.select(1)
  24. local data = turtle.getItemDetail()
  25. local sizeL = table.getn(l)
  26. for i=1,sizeL do
  27. if data.name == l[i] then
  28. putItem("L")
  29. end
  30. end
  31. for i =1,sizeR do
  32. if data.name == r[i] then
  33. putItem("R")
  34. end
  35. end
  36. putItem("F")
  37. end
  38.  
  39. while true do
  40. turtle.select(1)
  41. if turtle.suck() then
  42. local sortL = {}
  43. sortL[1] = ""
  44. local sortR = {}
  45. sortR[1] = ""
  46. decide (sortL, sortR)
  47. end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement