Posted 11 August 2012 - 07:50 AM
I haven't really used computer craft before but I thought this would be a good way to learn it.
The turtle treats the pillars as if they were square instead of round because it was easier to use a recursive function rather than dealing with lots of turns.
place the turtle like this facing the pillar and put fuel in slot 16. You also want everything above the turtle to be air.
o is empty space
x is obsidian
T is the turtle
The turtle treats the pillars as if they were square instead of round because it was easier to use a recursive function rather than dealing with lots of turns.
place the turtle like this facing the pillar and put fuel in slot 16. You also want everything above the turtle to be air.
o is empty space
x is obsidian
T is the turtle
ooxxxoo
oxxxxxo
xxxxxxx
xxxxxxx
xxxxxxx
oxxxxxo
ooxxxoo
T
function moveForward()
if turtle.getFuelLevel() <=0 then
turtle.select(16)
turtle.refuel()
end
turtle.forward()
end
function digForward(x)
for i=1,x do
turtle.dig()
moveForward()
end
end
function digArea(x)
if x<=1 then
turtle.dig()
else
digForward(x)
turtle.turnRight()
digForward(x-1)
turtle.turnRight()
digForward(x-1)
turtle.turnRight()
digForward(x-2)
turtle.turnRight()
digArea(x-2)
turtle.turnLeft()
moveForward()
turtle.turnLeft()
moveForward()
turtle.turnRight()
turtle.turnRight()
end
end
--get area to dig--
term.clear()
term.setCursorPos(1,7)
write("Enter diamater to dig - ")
local d = tonumber(io.read())
term.clear()
term.setCursorPos(1,7)
write("Enter Height to dig - ")
local h = tonumber(io.read())
for j=1,h do
digArea(d)
if turtle.getFuelLevel() <=0 then
turtle.select(16)
turtle.refuel()
end
turtle.up()
end
for j=1,h do
if turtle.getFuelLevel() <=0 then
turtle.select(16)
turtle.refuel()
end
turtle.down()
end