Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function putItem(s)
- if s == "L" then
- turtle.turnRight()
- turtle.drop()
- turtle.turnLeft()
- elseif s == "R" then
- turtle.turnLeft()
- turtle.drop()
- turtle.turnRight()
- else
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.drop()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- local function decide(l, r)
- turtle.select(1)
- local data = turtle.getItemDetail()
- local sizeL = table.getn(l)
- local sizeR = table.getn(r)
- for i=1,sizeL do
- if data.name == l[i] then
- putItem("L")
- end
- end
- for i =1,sizeR do
- if data.name == r[i] then
- putItem("R")
- end
- end
- putItem("F")
- end
- while true do
- turtle.select(1)
- if turtle.suck() then
- local sortL = {}
- sortL[1] = ""
- local sortR = {}
- sortR[1] = ""
- decide (sortL, sortR)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement