iniciar-programa define-nueva-instruccion norte como inicio
mientras no orientado-al-norte hacer gira-izquierda;
fin;
define-nueva-instruccion sur como inicio
mientras no orientado-al-sur hacer gira-izquierda;
fin;
define-nueva-instruccion este como inicio
mientras no orientado-al-este hacer gira-izquierda;
fin;
define-nueva-instruccion oeste como inicio
mientras no orientado-al-oeste hacer gira-izquierda;
fin;
    inicia-ejecucion
    este;
    mientras no junto-a-zumbador hacer
    si frente-libre entonces avanza;
    norte;
    mientras junto-a-zumbador hacer
    inicio
        si junto-a-zumbador entonces coge-zumbador;
        si frente-libre entonces avanza;
    fin;
    sur;
    mientras frente-libre hacer avanza;
    mientras algun-zumbador-en-la-mochila hacer deja-zumbador;
    oeste;
    mientras frente-libre hacer avanza;
    norte;
    avanza;
    mientras frente-libre hacer
    inicio
        oeste;
        si frente-libre entonces avanza;
        este;
        mientras frente-libre hacer
        inicio
            si junto-a-zumbador entonces coge-zumbador;
            avanza;
            si junto-a-zumbador entonces coge-zumbador;
        fin;
        oeste;
        mientras frente-libre hacer avanza;
        este;
        avanza;
        norte;
        si frente-libre entonces avanza;

    fin;
    sur;
    mientras frente-libre hacer avanza;
    si algun-zumbador-en-la-mochila entonces
    oeste;
    avanza;
    mientras algun-zumbador-en-la-mochila hacer deja-zumbador;
    este;
    avanza;
    mientras no-junto-a-zumbador hacer avanza;
    mientras junto-a-zumbador hacer coge-zumbador;
    norte;
    mientras algun-zumbador-en-la-mochila hacer inicio
        si algun-zumbador-en-la-mochila entonces deja-zumbador;
        si frente-libre entonces avanza;
    fin;





        apagate;
    termina-ejecucion
finalizar-programa
