This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Cosa's profile picture

Branch mining turtle

Started by Cosa, 26 December 2012 - 12:06 AM
Cosa #1
Posted 26 December 2012 - 01:06 AM
So I wrote my first branch mining script,
It works perfect, also when it encounters gravel / sand, but where and how could I make the code even better / shorter?

http://pastebin.com/XKEHRByM

Thanks :)/>
RunasSudo-AWOLindefinitely #2
Posted 28 December 2012 - 12:33 AM
I'm not sure if people would approve of asking "what can I do" questions, but anyway:
  1. Fix your indentation. Line 6 really threw me off until I realised it was a statement, not a function.
  2. Modify lines 11 to 15 so that it doesn't dig in all 3 directions whenever there's something in only one of them.
  3. Not a big deal, but most code is written in English.
  4. I'm not sure what lines 30+ are supposed to do (mine in some crazy hard-coded order?) but I reckon a for/while loop would work better.