Advertisement
Digitamz

Sucker v2

Jun 27th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 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. turtle.select(1)
  21. local data = turtle.getItemDetail()
  22. local sizeL = table.getn(l)
  23. local sizeR = table.getn(r)
  24. for i=1,sizeL do
  25. if data.name == l[i] then
  26. putItem("L")
  27. end
  28. end
  29. for i =1,sizeR do
  30. if data.name == r[i] then
  31. putItem("R")
  32. end
  33. end
  34. putItem("F")
  35. end
  36.  
  37. while true do
  38. turtle.select(1)
  39. if turtle.suck() then
  40. local sortL = {}
  41. sortL[1] = ""
  42. local sortR = {}
  43. sortR[1] = ""
  44. decide (sortL, sortR)
  45. end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement