I think it might be a good idea to stick those item tables into a separate file (eg an API) and load them from there. Perhaps just make it one table, then put it together with some functions which can perform searches for items with certain attributes (eg, "isOre", "isWood", "multipliable" (for stuff affected by Fortune), etc - you'd need to define these properties manually). Just a thought.
I'd say checking left/right should be done last, as this would potentially decrease the number of turns the turtle needs to perform in order to complete its task. For example, a 2x2x2 cube requires ten turns with your current logic, but it could be done with six.
I recommend making separate functions for moving up/down/forward, and even for back. Rig them so they can't fail (remember that turtle.dig() doesn't deal with mobs, and mobs can also move behind a turtle that wishes to move backwards - it'd ideally turn around in such a circumstance, and deal with the problem). I've even found turtle.turnLeft()/turtle.turnRight() to be unreliable under some circumstances, though since they
do reliably return whether they succeeded or not, that's not a problem if you account for it. I have a
hunch that running multiple yielding turtle functions in parallel (like you're doing) might be one such way to trigger movement failures, but it's a guess.
Likewise, I'd move the refueling check out of the "manager" and into a turtle movement calling function. Currently, if the turtle is low on fuel, it will try to turtle.select() its fuel slot. If it encounters lava at the same time, the search function will try to select the bucket slot... which yields, so the manager function may take the opportunity to try to set it back again before the turtle can fill its bucket. A rare scenario, but all eventualities should be accounted for.
You could shrink your code a bit by adding lava to the whitelist. You could shrink it
more by adding sets of function pointers into tables within a sub-table, then just having
one search function instead of six.
main() isn't keeping track of "gone" correctly. It should be starting it at 0, and it only increments it once for every four movements forwards.
Just by eyeing the code I can't see where the turtle would lose track of its orientation. Exactly when does it happen? While searching, or...?
Edited by Bomb Bloke, 29 September 2014 - 03:20 PM.