iniciar-programa
    define-nueva-instruccion norte como mientras no orientado-al-norte hacer gira-izquierda;
    define-nueva-instruccion sur como mientras no orientado-al-sur hacer gira-izquierda;
    define-nueva-instruccion este como mientras no orientado-al-este hacer gira-izquierda;
    define-nueva-instruccion oeste como mientras no orientado-al-oeste hacer gira-izquierda;

    define-nueva-instruccion contar como
        inicio
           si junto-a-zumbador entonces
           coge-zumbador;
           si junto-a-zumbador entonces contar;

           si orientado-al-norte entonces sur;
           si orientado-al-sur entonces avanza;
           este;
           inicio
              si junto-a-zumbador entonces
              coge-zumbador;
              si no junto-a-zumbador y frente-libre entonces
              avanza;

           fin;

        fin;
        define-nueva-instruccion dejar como
            inicio
               oeste;
               mientras frente-libre hacer
               avanza;
               norte;
               avanza;
               mientras algun-zumbador-en-la-mochila hacer
               deja-zumbador;
               sur;
               avanza;
               este;

            fin;
            define-nueva-instruccion acomodar como
                inicio

                       mientras frente-libre y no junto-a-zumbador hacer

                       si frente-libre entonces avanza;
                       si no junto-a-zumbador entonces apagate;
                       mientras junto-a-zumbador hacer
                       coge-zumbador;
                       oeste;
                       mientras frente-libre hacer avanza;
                       este;
                       mientras junto-a-zumbador hacer avanza;
                       mientras algun-zumbador-en-la-mochila hacer
                       deja-zumbador;
                       mientras junto-a-zumbador y frente-libre hacer avanza;

                       si frente-libre entonces acomodar;


               fin;

    inicia-ejecucion
        norte;
        avanza;
        mientras algun-zumbador-en-la-mochila hacer
        deja-zumbador;
        contar;
        dejar;

        acomodar;
        apagate;
    termina-ejecucion
finalizar-programa
