Whiskee icon

turtle - build tower

Whiskee | PRO | 12/29/20 09:50:00 PM UTC (Edited) | 0 ⭐ | 737 👁️ | Never ⏰ | []
Lua |

810 B

|

None

|

0 👍

/

0 👎

local curLevel = 0
local backStep = 0
local x = 0
local turns = 0
 
local loop = true
 
function shouldPlaceBlock()
    if (curLevel == 4) then
        return true
    elseif (backStep == 1) then
        return true
    end
end
 
while (loop) do
    if ( shouldPlaceBlock() ) then
        turtle.place()
    end
 
    turtle.back()
    backStep = backStep + 1
 
    if ( shouldPlaceBlock() ) then
        turtle.place()
    end
 
    if (turns >= 3) then
        turtle.up()
        curLevel = curLevel + 1
        turns = 0
    end
    if (curLevel > 4) then
        curLevel = 0
    end
    
    if (x == 0 and backStep == 15) then
        x = 1
        turtle.turnLeft()
        backStep = 0
        turns = turns + 1
    elseif (x == 1 and backStep == 22) then
        x = 0
        turtle.turnLeft()
        backStep = 0
        turns = turns + 1
    end
end

Comments