Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function start()
- write("Longueur ?")
- longueur = read()
- longueurs = tonumber(longueur)
- if longueurs >= 4 then
- write("Combien de chemin ?")
- chemin = read()
- chemins = tonumber(chemin)
- if chemins >= 1 then
- write("Quel est le slot du charbon ?")
- coal_slot = read()
- coal_slot = tonumber(coal_slot)
- write("Nous allons faire : " .. chemin .. " chemins de " .. longueur .. " longueur.")
- coal()
- end
- else
- write("Cela doit รชtre un nombre plus grand que 3")
- end
- end
- function coal()
- moves = longueurs * chemins + 3 * chemins
- active_coal = turtle.getFuelLevel()
- active_coal = tonumber(active_coal)
- if moves > active_coal then
- coal = moves - active_coal
- coal = coal / 80
- coal = math.ceil(coal)
- write("Active coal : " .. active_coal .. " moves : " .. moves .. " coal: " .. coal .. " slot : " .. coal_slot .. " count : " .. turtle.getItemCount(coal_slot))
- if turtle.getItemCount(coal_slot) >= coal then
- turtle.select(coal_slot)
- turtle.refuel(coal)
- mine()
- else
- write("Veuillez insรฉrer " + coal + " charbons dans le slot " + coal_slot)
- os.sleep(6)
- coal()
- end
- else
- mine()
- end
- end
- function deposing()
- turtle.dig()
- turtle.select(1)
- turtle.place()
- for i = 2,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- turtle.dig()
- end
- function mine()
- blocks = 0
- for i = 1, chemin do
- for c = 1, longueur do
- graphic()
- if turtle.getItemCount(16) == 0 then
- turtle.dig()
- blocks++
- turtle.forward()
- turtle.digUp()
- blocks++
- else
- deposing()
- end
- end
- if (i%2 == 0) then
- turtle.turnRight()
- turtle.dig()
- blocks++
- turtle.forward()
- turtle.digUp()
- blocks++
- turtle.dig()
- blocks++
- turtle.forward()
- turtle.digUp()
- blocks++
- turtle.dig()
- blocks++
- turtle.forward()
- turtle.digUp()
- blocks++
- turtle.turnRight()
- else
- turtle.turnLeft()
- turtle.dig()
- blocks++
- turtle.forward()
- turtle.digUp()
- blocks++
- turtle.dig()
- blocks++
- turtle.forward()
- turtle.digUp()
- blocks++
- turtle.dig()
- blocks++
- turtle.forward()
- turtle.digUp()
- blocks++
- turtle.turnLeft()
- end
- end
- end
- function graphic()
- term.setBackgroundColor(colours.black)
- term.clear()
- term.setCursorPos(1,1)
- print("Il reste " .. moves .. " mouvements")
- print("Il reste " .. turtle.getFuelLevel().. " de fuel")
- print(blocks .. "on deja ete mines")
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement