I wrote a program called TurtleTB (turtle tunnel bore). It's definitely not perfect, and I know about some efficiency improvements that can be done, but it definitely works really well for digging tunnels.

The syntax is TurtleTB distance numberOfTurnarounds
numberOfTurnarounds must be a number or no, or nothing. no or nothing means that the program will not turn around, and just stop at the end of the tunnel.

It is open-source (LIKE EVERY FREAKING CC PROGRAM THAT ISN'T BYTECODE SAVED TO A FILE!), and what most people call open-source, so it's also on github here: https://github.com/Graypup/TurtleTB

There are various config variables at the start of the source code, so please configure them how you want them.
UsingEnderChest means that the turtle will break the chest after putting its stuff in it. Otherwise it will leave the chest in the bottom of the tunnel. Note: it doesn't fill in holes in the floor left by enderchest placement

Chests go in the last item slot, torches in the second last. I will add something for when the turtle runs out of chests, but for now, just make sure the chest item slot is full when refilling torches.

It's in the public domain, have fun doing whatever you want. Preferably credit me, though I can't do anything about you not doing so. :)/>