SHARE
TWEET

Take v1

Digitamz Jun 27th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     local forw = true
  25.     for i=1,sizeL do
  26.         if data.name == l[i] then
  27.             putItem("L")
  28.             forw = false
  29.         end
  30.     end
  31.     for i =1,sizeR do
  32.         if data.name == r[i] then
  33.             putItem("R")
  34.             forw = false
  35.         end
  36.     end
  37.     if forw then
  38.         putItem("F")
  39.     end
  40. end
  41.  
  42. while true do
  43.     turtle.select(1)
  44.     if turtle.suck() then
  45.         local sortL = {}
  46.             sortL[1] = "a"
  47.         local sortR = {}
  48.             sortR[1] = "a"
  49.         decide (sortL, sortR)
  50.     end
  51. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top