Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- turtle.select(2)
- turtle.refuel()
- local a = 0
- -- a is for comparing length, b is for width, and c is determining right or left at the end, default is turn right at first --and switch.
- local b = 0
- local c = 0
- local length = 60
- local width = 60
- local miners = 0
- local height = 0
- local fuellevel = turtle.getFuelLevel()
- --check for file to save variables to
- if not fs.exists("Adata", "w") then
- local file = io.open("Adata", "w")
- file:write()
- file:close()
- end
- if not fs.exists("Bdata", "w") then
- local file = io.open("Bdata", "w")
- file:write()
- file:close()
- end
- if not fs.exists("Cdata", "w") then
- local file = io.open("Cdata", "w")
- file:write()
- file:close()
- end
- local function saveDataA()
- local file = io.open("Adata", "w')
- file:write(a)
- file:close()
- end
- local function saveDataB()
- local file = io.open("Bdata", "w')
- file:write(b)
- file:close()
- end
- local function saveDataC()
- local file = io.open("Cdata", "w')
- file:write(c)
- file:close()
- end
- local file = io.open("Adata", "r") --open in read mode
- a = file:read()
- file:close()
- local file = io.open("Bdata", "r") --open in read mode
- b = file:read()
- file:close()
- local file = io.open("Cdata", "r") --open in read mode
- c = file:read()
- file:close()
- repeat
- repeat
- turtle.dig()
- if turtle.detect() == true then
- repeat
- turtle.dig()
- until turtle.detect() == false
- end
- turtle.forward()
- turtle.digDown()
- a = a + 1
- saveDataA()
- if turtle.getItemCount(16) ~= 0 then
- turtle.select(1)
- turtle.back()
- turtle.down()
- turtle.place()
- for i = 2,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.up()
- turtle.forward()
- turtle.select(2)
- end
- until a == length
- a = 0
- if ( c == 0 ) then
- turtle.turnRight()
- turtle.dig()
- if turtle.detect() == true then
- repeat
- turtle.dig()
- until turtle.detect() == false
- end
- turtle.forward()
- turtle.digDown()
- turtle.turnRight()
- b = b + 1
- saveDataB()
- end
- if ( c == 1 ) then
- turtle.turnLeft()
- turtle.dig()
- if turtle.detect() == true then
- repeat
- turtle.dig()
- until turtle.detect() == false
- end
- turtle.forward()
- turtle.digDown()
- turtle.turnLeft()
- b = b + 1
- end
- if ( c == 1) then
- c = 0
- saveDataC()
- elseif ( c == 0) then
- c = 1
- saveDataC()
- else
- end
- turtle.refuel()
- fuellevel = turtle.getFuelLevel()
- print("number of runs "..b)
- print("fuel level " ..fuellevel)
- until b == width
- a = 0
- b = 0
- c = 0
- saveDataA()
- saveDataB()
- saveDataC()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement