Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get MPZeT0AT startup
- -- _____
- -- | ___| _ _ __ ___
- -- | |_ | | | | '_ \ / __|
- -- | _|| |_| | | | | (__
- -- |_| \__,_|_| |_|\___|
- --
- select = function(id)
- return turtle.select(id)
- end
- count = function(id)
- return turtle.getItemCount(id)
- end
- move = function(id, nb)
- return turtle.transferTo(id, nb)
- end
- suck = function()
- return turtle.suck()
- end
- dropUp = function()
- return turtle.dropUp()
- end
- dropDown = function()
- return turtle.dropDown()
- end
- compare = function()
- local j = 0
- for j = 9, 16 do
- if(turtle.compareTo(j)==true)then
- return true
- end
- end
- return false
- end
- compareAll = function()
- -- return True si on trouve un idem qui n'est pas dans la liste (slot 9,16)
- local j = 0
- local k = 0
- local flag = false
- for k = 1, 8 do
- if(count(k)>0)then
- select(k)
- flag = false
- for j = 9, 16 do
- if(count(j)>0)then
- if(turtle.compareTo(j)==true)then
- flag = true
- j=16
- end
- end
- end
- if(flag == false)then
- return true
- end
- end
- end
- return false
- end
- dropDrone = function()
- local k = 0
- local flag = false
- for k = 1, 8 do
- if(count(k)>0)then
- select(k)
- if(turtle.compareTo(16)==true)then
- dropDown(count(16))
- flag = true
- end
- end
- end
- return flag
- end
- dropReste = function()
- local i = 0
- for i = 1, 8 do
- if(count(i)>0)then
- select(i)
- if(compare()==true)then
- dropDown(count(i))
- else
- dropUp(count(i))
- end
- end
- end
- end
- function stuff()
- if(compareAll()==true)then
- dropDrone()
- dropReste()
- end
- end
- -- __ __ _ ____
- -- | \/ | __ _(_)_ __ / /\ \
- -- | |\/| |/ _` | | '_ \| | | |
- -- | | | | (_| | | | | | | | |
- -- |_| |_|\__,_|_|_| |_| | | |
- -- \_\/_/
- stop=false
- local l = 0
- select(1)
- while(stop==false)do
- for l = 1, 8 do
- if(count(l)>0)then
- stuff()
- end
- end
- select(1)
- while suck() do
- sleep(1)
- end
- sleep(3)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement