Posted 24 April 2015 - 11:42 PM
Hey guys, I am rather new to coding and wrote a program that I am having issues fixing. I have one mistake but can't find where it is. It is a strip mine program for a mining turtle that allows me to create a main tunnel and branches going off to the side. The only issue I have found is that after I get my branch on the right and it turns and does the one on the left it doesn't stop mining. The right goes perfectly. 50 blocks, and comes back. Then it starts mining the left side, it goes down to the 50th block and just keeps going.
local i = 1
repeat
repeat
turtle.dig()
turtle.forward()
turtle.turnRight()
turtle.digUp()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnRight()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnRight()
turtle.forward()
turtle.digUp()
turtle.dig()
turtle.forward()
turtle.dig()
turtle.digUp()
i = i + 1
until i == 2
repeat
turtle.dig()
turtle.forward()
turtle.digUp()
i = i + 1
until i == 50
turtle.turnRight()
turtle.turnRight()
repeat
turtle.forward()
i = i + 1
until i == 53
repeat
turtle.dig()
turtle.forward()
turtle.digUp()
i = i + 1
until i == 50
turtle.turnRight()
turtle.turnRight()
repeat
turtle.forward()
i = i + 1
until i == 51
turtle.turnLeft()
i = i + 1
until i == 50