Posted 26 April 2014 - 09:03 PM
Hi! i have a question for someone more well versed in CC than i am. I created a short turtle program to branch by itself.
It Works perfectly except for when it encounters gravel, so i searched the interwebs for answers and got to this page:
http://www.computerc...mining-program/
no matter what i do, the moment the program finds it way down to the loop it loops forever! The turtle endlessly mines forward.
tiny chunk responsible:
the entire code:
any sort of constructive critisism is appreciated!
It Works perfectly except for when it encounters gravel, so i searched the interwebs for answers and got to this page:
http://www.computerc...mining-program/
no matter what i do, the moment the program finds it way down to the loop it loops forever! The turtle endlessly mines forward.
tiny chunk responsible:
[ for i=1,10 do
turtle.dig()
turtle.forward()
if turtle.forward() == false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
turtle.digUp()
end
the entire code:
local tArgs = {...}
local function tunnel()
turtle.refuel(1)
turtle.forward()
turtle.turnLeft()
for i=1,10 do
turtle.dig()
turtle.forward()
if turtle.forward() == false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
turtle.digUp()
end
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnRight()
for i=1,4 do
turtle.dig()
turtle.forward()
if turtle.forward() == false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
turtle.digUp()
end
turtle.turnRight()
turtle.select(2)
turtle.place()
turtle.turnLeft()
for i=1,5 do
turtle.dig()
turtle.forward()
if turtle.forward() == false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
turtle.digUp()
end
turtle.refuel(1)
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.forward()
end
for i=1,tArgs[1] do
tunnel()
end
any sort of constructive critisism is appreciated!