function deplace()
	info("Deplacement")
	if turtle.getFuelLevel()~=0 then
		turtle.select(16)
		turtle.refuel(1)
	end
	turtle.forward() 
end

function verif()
	ok, donne = turtle.inspectDown()
	if donne.name=="Botania:livingrock" then
		return false
	else
		return true
	end
end
function change()
	info("Attente")
	while verif() do
		os.sleep(3)
	end
	info("Minage / placement")
	turtle.select(2)
	turtle.digDown()
	turtle.select(1)
	turtle.placeDown()
end
function info(text)
	term.clear()
	term.setCursorPos(1,1)
	print(text)
end

local pos=0
local coin=0
local perma=true

function go()
	while perma do
		change()
		if pos==2 then
			info("Depart")
			if coin==3 then
				turtle.select(2)
				turtle.drop()
			end
			
			if coin==3 then
				turtle.turnLeft()	
				if turtle.getItemCount(1) == 0 then
					turtle.select(1)
					turtle.suck()
					if turtle.getItemCount(1) == 0 then
						perma=false
						return false
					end	
				end			
				if turtle.getItemCount(16) == 0 then
					turtle.select(16)
					turtle.suck()
				end		
				coin=0
			else
				turtle.turnRight()	
			end
			pos=0
			coin=coin+1
		end	
		deplace()
		pos=pos+1
	end
end
go()