Add test.txt
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
io.write("Cube height? (top to bottom):")
|
||||
local height = tonumber(io.read())
|
||||
|
||||
io.write("Cube width? (left to right):")
|
||||
local width = tonumber(io.read())
|
||||
|
||||
io.write("Cube depth? (front to back):")
|
||||
local depth = tonumber(io.read())
|
||||
|
||||
io.write("Dig direction? (up/down):")
|
||||
local dir = io.read()
|
||||
|
||||
local digVert, moveVert, digBack, moveBack
|
||||
if dir == "up" then
|
||||
digVert = turtle.digUp
|
||||
moveVert = turtle.up
|
||||
digBack = turtle.digDown
|
||||
moveBack = turtle.down
|
||||
else
|
||||
digVert = turtle.digDown
|
||||
moveVert = turtle.down
|
||||
digBack = turtle.digUp
|
||||
moveBack = turtle.up
|
||||
end
|
||||
|
||||
for d = 1, depth do
|
||||
turtle.refuel(1)
|
||||
turtle.turnLeft()
|
||||
|
||||
local goingUp = true
|
||||
|
||||
for w = 1, width do
|
||||
turtle.dig()
|
||||
turtle.forward()
|
||||
|
||||
if goingUp then
|
||||
for h = 1, height - 1 do
|
||||
digVert()
|
||||
moveVert()
|
||||
end
|
||||
else
|
||||
for h = 1, height - 1 do
|
||||
digBack()
|
||||
moveBack()
|
||||
end
|
||||
end
|
||||
|
||||
goingUp = not goingUp
|
||||
end
|
||||
|
||||
-- return to original height
|
||||
if not goingUp then
|
||||
-- ended at top, come back down
|
||||
for h = 1, height - 1 do
|
||||
moveBack()
|
||||
end
|
||||
end
|
||||
|
||||
-- face depth
|
||||
turtle.turnLeft()
|
||||
|
||||
if d < depth then
|
||||
turtle.dig()
|
||||
turtle.forward()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user