in math

Quarrying with ComputerCraft Turtles

I just recently began playing with ComputerCraft, which is a very cool Minecraft mod that adds programmable computers.   There are also turtles, which are basically computers that can carry out tasks like mining, digging, attacking, etc.  Turtles are fully programmable using Lua and various APIs.  You can do lots of amazing things with turtles.

This is not something amazing, but just a simple modification I made to the turtle's excavate program that allows you to dig stepped quarries giving easier retrieval of the ores around the edges:

9x9 excavate:

excavate14x14x3 quarry:quarry

 Source. You can copy this script directly to your turtle using the turtle's pastebin program.

To dig a quarry, you specify the diameter d and the number of blocks to dig down at each diameter, h_d.

It's a fun exercise to work out some of the properties of the resulting quarries.  Given a d and h_d, you can dig a quarry that is h_t blocks deep, where h_t=floor(\frac{d}{2}h_d) if d is even and h_t=ceil(\frac{d}{2}h_d) if d is odd.  The total height of the quarry is related to the number of constant-diameter levels, N_l by N_l=\frac{h_t}{h_d}.

Given a d and h_d, the total number of blocks you mine in a quarry, N_b, is found by simply adding up all the blocks at a given level and then adding all the levels.  Noting that d decreases by two blocks each time you make the quarry square smaller,

N_b = h_d[d^2 + (d-2)^2 + (d-4)^2 + ... + (d-2\eta)^2]

where \eta is related to N_l.   Writing this in summation form,

N_b = \sum_{m=0}^{\eta}h_d(d-2m)^2

where \eta=ceil(N_l)-1.  Now, the summation bit is straightforward to see, but the upper limit \eta took some playing around in Mathematica for me to work it out.  This seems to work pretty well, but if anyone can derive this limit (or a better one) more "rigorously", please let me know!

Write a Comment

Comment