--Program: fuel

count = 1
onetime = 1
done = false;

geothermal = (...);
g = geothermal;

if geothermal == nil then
	print "Is it for the goethermal generator? Y/N"
	e,a = os.pullEvent("key");

	if a == 21 then
		geothermal = "g";
		g = geothermal;
	elseif a == 49 then
		geothermal = nil;
		g = geothermal;
	else
		print("Y or N only!");
		sleep(0.1)
		error();
	end
end

function forward()
	while not turtle.forward() do
		turtle.attack()
	end
end

while turtle.detectDown() do
	forward();
end

if g == "g" then
	while count <= 17 do
		if turtle.detect() then
			done = true;
			break
		end
		turtle.select(1)
		turtle.placeDown()
		forward()
		count = count  + 1
		if count == 17 then
			done = true;
			break
		end
	end
else
	while not turtle.detect() do
		turtle.select(1)
		turtle.placeDown()
		turtle.refuel()
		forward()
		count = count + 1
		if turtle.detect() then
			done = true;
			break
		end
	end
end
if done then
	while count >= 0 do
		if onetime == 1 then
			turtle.turnLeft()
			turtle.turnLeft()
			onetime = 0
		end
		forward()
		count = count - 1
		if count == 0 then 
			print "Finshed"
			error()
		end
	end
end