Message Board


Message Board > Programming > Minecraft ComputerCraft turtle digging automation

April 1, 2013, 11:29
Zomg
None
641 posts
I just started learning Lua, the scripting language. It's procedural so I took a while to get used to it.

Now I wrote a script to let a little ComputerCraft robot dig around a field of dirt. Hehehe.

http://www.minecraftforum.net/ … mation-program/
____________
#
November 10, 2013, 00:14
PB
Defender of the faith
630 posts

Well I've never written Lua or installed ComputerCraft, but it looks like your code will get a huge callstack over time.

The point is, that dig will call checkNeighbor at some point, which will call either goRight, goLeft or checkAwayNeighbor. Any of those three functions will call dig again.

Since the parent dig function was already in a while loop, I would think (only from reading your code, I've not run it) that the program would be better of if goLeft, goRight or checkAwayNeighbor would not call dig. It would continue the same way, accept for het call stack not increasing over time...
____________
#
November 10, 2013, 13:38
Zomg
None
641 posts
Thank you for that finding, PB. I will look into it sometime.
I have not yet done stress or load testing on my product. =)
____________
#

Message Board > Programming > Minecraft ComputerCraft turtle digging automation

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!