iniciar-programa
define-nueva-instruccion derecha como inicio
 repetir 3 veces inicio
  gira-izquierda;
 fin;
fin;
define-nueva-instruccion vuelta como inicio
 repetir 2 veces inicio
  gira-izquierda;
 fin;
fin;
define-nueva-instruccion despacha como inicio
 mientras algun-zumbador-en-la-mochila y orientado-al-este  hacer inicio
  mientras junto-a-zumbador y orientado-al-este hacer inicio
   coge-zumbador;
   gira-izquierda;
  fin;
   despacha;
  fin;
 si FRENTE-libre entonces inicio
   avanza;
  fin;
   deja-zumbador;
  fin;
    inicia-ejecucion
mientras  algun-zumbador-en-la-mochila y orientado-al-este hacer inicio
 mientras no-junto-a-zumbador y frente-libre y orientado-al-este hacer inicio
  avanza;
 fin;
 mientras junto-a-zumbador y algun-zumbador-en-la-mochila y orientado-al-este hacer inicio
  despacha;
 fin;
 si orientado-al-norte y junto-a-zumbador entonces inicio
  vuelta;
 fin;
 mientras frente-libre y orientado-al-sur hacer inicio
  avanza;
 fin;
 si orientado-al-sur y frente-bloqueado entonces inicio
  GIRA-IZQUIERDA;
 fin;
 si no-junto-a-zumbador y frente-libre entonces inicio
  avanza;
 fin;
 si frente-bloqueado y orientado-al-este y no-junto-a-zumbador o ningun-zumbador-en-la-mochila entonces inicio
  vuelta;
 fin;
fin;
mientras ningun-zumbador-en-la-mochila y orientado-al-oeste y frente-libre hacer inicio
 mientras junto-a-zumbador y orientado-al-oeste hacer inicio
  coge-zumbador;
 fin;
 mientras no-junto-a-zumbador y frente-libre y orientado-al-oeste hacer inicio
  avanza;
 fin;
 si frente-bloqueado y orientado-al-oeste y algun-zumbador-en-la-mochila o junto-a-zumbador entonces inicio
  vuelta;
 fin;
 si junto-a-zumbador y algun-zumbador-en-la-mochila entonces inicio
  avanza;
 fin;
 mientras algun-zumbador-en-la-mochila y orientado-al-este hacer inicio
  deja-zumbador;
 fin;
 si junto-a-zumbador y orientado-al-este entonces inicio
  avanza;
 fin;
 mientras no junto-a-zumbador y orientado-al-este y frente-libre hacer inicio
  avanza;
 fin;
 si  junto-a-zumbador entonces inicio
  vuelta;
 fin;
fin;
        apagate;
    termina-ejecucion
finalizar-programa
