This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
gronkdamage's profile picture

Writing a tunneling program - that goes through lava...

Started by gronkdamage, 04 April 2013 - 05:38 PM
gronkdamage #1
Posted 04 April 2013 - 07:38 PM
So quick explanation first: When I mine, I dig in a straight line - then every 3rd block I create a perpindicular path. I wrote a program that digs a tunnel; digs out the walls - and replaces them cobblestone. Basically, I end up with a 1 x 3 tunnel, where everything around it (top, bottom and sides) is dug out and replaced with cobblestone.

My problem is bedrock. Currently, to account for gravel - I dig and check again if there's a block; and keep doing that until I can place cobble. Bedrock is a problem - any way around this? Currently, I just try 5 times and then give up; but is there a better way of getting around cobble?

Here's my current code:


local function PlaceBlock()
checker = 0
  while turtle.place() == false do
   if turtle.detect() == false then
	turtle.attack()
	turtle.place()
   else
	turtle.dig()
	turtle.place()
	checker = checker +1
	sleep(0.25)
	if checker > 5 then
	 return
   end
  end
end
end 

Please tell me there's a better way of doing this? :)/>
gronkdamage #2
Posted 04 April 2013 - 08:02 PM
Ugh; I was being dumb - I fixed my code by saying if turtle.dig = false; it's bedrock… otherwise, try to place the block; if that fails - it'd keep trying because it's most likely gravel…
Ray_Anor #3
Posted 05 April 2013 - 12:43 AM

function down()
  turtle.select(16)
  while turtle.detectDown() do
    turtle.digDown()
    if turtle.detectDown() then
	  return nil
    end
  end
  if not checkFuel() then
    return false
  end
  while not turtle.down() do
    turtle.attackDown()
  end
  depth=depth+1
  return true
end

Look at this sample of code. It return true if have moved down and digging. Return false - if have no fuel. And return nil - when stucked with some undiggable.
Telokis #4
Posted 05 April 2013 - 01:25 AM
It's quite simple : If you can't dig and there is a block, it is bedrock !
theoriginalbit #5
Posted 05 April 2013 - 01:38 AM
-snip-
the code wasn't going down in OP, it was going forward.
Ray_Anor #6
Posted 05 April 2013 - 01:43 AM
-snip-
the code wasn't going down in OP, it was going forward.

It's a SAMPLE.