

function log2()
    tx.dig()
    tx.forward()
    -- assume slot 1 is the log
    big_tree = false
    tx.select(1)
    if tx.compare() then
        tx.left()
        if tx.compare() then
            big_tree = 'left'
            tx.right()
        else
            tx.right()
            tx.right()
            if tx.compare() then
                big_tree = 'right'
            end
            tx.left()
        end
    end
    
    print('big_tree = '..tostring(big_tree))
    print('Fuel left: '..turtle.getFuelLevel())
    
    height = 0    
    while tx.detect() do
        tx.dig()
        tx.digUp()
        while not tx.up() do end
        height = height +1             
    end
    
    print('reached top, moving over')
    
    tx.digUp()
    tx.up()
    tx.dig()
    tx.forward()
    tx.left()
    tx.forward()
    tx.left()
    tx.digDown()
    tx.down()
     
    while height > 0 do
        tx.dig()
        tx.digDown()
        while not tx.down() do end
        height = height - 1             
    end
    
    tx.dig()
    tx.forward()
    
end

log2()