Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local configue = {x,z,y}
- configue.x = 10
- configue.z = 10
- configue.y = 0
- local z = 1
- local x = 1
- local y = 1
- local w = 0
- local maxCarbu = 100000
- local woodFuel = 15
- local nivCarbu = turtle.getFuelLevel()
- local function tourneDroite()
- turtle.turnRight()
- if w == 0 then
- w = 1 write(" droite ")
- elseif w == 1 then
- w = 2 write(" deriere ")
- elseif w == 2 then
- w = 3 write(" gauche ")
- elseif w == 3 then
- w = 0 write(" devant ")
- end
- end
- local function tourneGauche()
- turtle.turnLeft()
- if w == 0 then
- w = 3 write("gauche ")
- elseif w == 3 then
- w = 2 write("deriere ")
- elseif w == 2 then
- w = 1 write("droite ")
- elseif w == 1 then
- w = 0 write("devant ")
- end
- end
- local function carburant()
- o = x+z+20
- if o < nivCarbu then
- end
- local function dig()
- turtle.digUp()
- turtle.digDown()
- end
- local function deplaceMine()
- turtle.dig()
- turtle.forward()
- end
- local function deplaceZ()
- while z > 1 do
- turtle.forward()
- z = z-1
- write(" z:"..z)
- end
- end
- local function deplaceX()
- while x > 1 do
- turtle.forward()
- x = x-1
- write(" w:"..x)
- end
- end
- local function mineZ()
- if configue.z > z then
- while configue.z > z do
- if w == 0 then
- dig()
- deplaceMine()
- dig()
- z = z + 1
- write(" z:"..z)
- elseif w == 1 then
- tourneGauche()
- end
- end
- end
- if w == 1 then
- tourneDroite()
- if w == 2 then
- while z > 1 do
- dig()
- deplaceMine()
- dig()
- z = z-1
- write(" z:"..z)
- end
- end
- end
- end
- local function mineX()
- if w == 0 then
- tourneDroite()
- deplaceMine()
- x = x+1
- write(" x:"..x)
- elseif w == 2 then
- tourneGauche()
- deplaceMine()
- x = x + 1
- write(" x:"..x)
- end
- end
- local function mineXZ()
- while configue.x > x do
- mineZ()
- mineX()
- if configue.x == x then
- mineZ()
- end
- end
- end
- local function retourZ()
- while z > 1 do
- if w == 2 then
- deplaceZ()
- elseif w == 0 then
- tourneDroite()
- elseif w == 1 then
- tourneDroite()
- elseif w == 3 then
- tourneGauche()
- end
- end
- end
- local function retourX()
- while x > 1 do
- if w == 3 then
- deplaceX()
- elseif w == 0 then
- tourneGauche()
- elseif w == 1 then
- tourneDroite()
- elseif w == 2 then
- tourneDroite()
- end
- end
- end
- mineXZ()
- retourZ()
- retourX()
- turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement