-- cyclone3 -- サイクロン型直下掘り -- ######### Config ######### local maxDepth = 10 -- 真下に掘り進む回数 -- ######### Function ######### function kaitenChokkabori(shita) -- shita回だけ回転直下掘り local count = 0 -- 真下に移動した回数をカウントする変数 for i=1,shita do for j=1,4 do -- 一回転しつつ正面採掘 turtle.turnLeft() turtle.dig() end turtle.digDown() -- 直下掘り if turtle.down() then count = count + 1 -- 真下移動に成功したらcountの値を1増加 else break -- 真下移動に失敗したらforループを抜ける end end return count -- 戻り値としてcountを返す end function backToHome(ue) -- ue回だけ上昇する for i=1,ue do turtle.up() end end -- ######### Main ######### -- 燃料補給 turtle.select(1) turtle.refuel() local depth = kaitenChokkabori(maxDepth) backToHome(depth)