Jump to content




Turtle program to assist hollowing out structures (specifically natural structures)


2 replies to this topic

#1 seigfried13

  • New Members
  • 1 posts

Posted 27 January 2013 - 01:52 PM

Hello, I am new to the forums an relatively new to coding. I have some amount of experience with logic statements in general and have some familiarity with code syntax.

In my SMP server I am currently trying to hollow out a roughly 8x8 chunk mountain that is probably 10+ chunks high. On top of that I intend to line the interior surface with a block of my choosing. After spending some time using quarries and manually chiseling the interior contours, I have set out to design a turtle script to help me accomplish at least part of my task. Upon brainstorming how it would work I touched upon using a series of turtles all connected to a rednet server machine of sorts to have workers mapping out the outer contour of the mountain and workers inside reading this contour and mining appropriately. I quickly realized how over my head that would be and settled for starting small.

My current prospective program is one that would run on one mining turtle.
With T being the turtle and X being the mountain blocks,

    X
   X X
  X   X
TX     X

the turtle will keep track of elevation and traverse the mountain, storing elevation for each position in an array. Upon reaching elevation 0 again, it will know to stop, turn 180 degrees and burrow in to mountain to begin lining the interior.

This is where I run in to trouble. If the slopes were all simple 1x1 stair steps, I wouldn't have a problem with simply subtracting the stored elevation with a current turtle elevation to dig and place a block under the shell block, but patterns like:

   X
XX

and

 X
 X
X

throw me off. Does anyone have any suggestions on an algorithm that would properly contract the voxel radius? Or even a better way of going about this project?

I had originally hoped for some way to sense more than one block in front of turtle so that I could simply mine forward until two blocks in front = air, then appropriately turn around and mine back the other way on the next row.

Thanks in advance.

EDIT: Thanks for the split, edited the formatting of my diagrams

Edited by seigfried13, 27 January 2013 - 02:08 PM.
added code tags for ascii art


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 27 January 2013 - 02:02 PM

Split into new topic.

#3 crazyguymgd

  • Members
  • 139 posts
  • LocationUSA

Posted 27 January 2013 - 04:24 PM

So to think about this, I broke up the shape of the shell into each possible case, similar to what you were asking about. These cases (without overhangs) should be:


xx
t
y1 == y2
z1 < z2
forward

 x
x
t
y1 < y2
z1 < z2
forward, up

tx
  x
y1 > y2
z1 < z2
down, forward

x
xt
y1 < y2
z1 == z2
up

tx
 x
y1 > y2
z1 == z2
down

If I think of any others, I'll add them and if I think of any mistakes, I'll fix them. But from what you say you've done so far, I think you might be able to figure out how to use these rules to get the turtle to traverse the inside of the shell. If not, I'm working on testing this right now because I think this is a pretty cool problem so I can help you out based on what I discover in my tests.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users