class program {
define faceNorth()
   {
      while(notFacingNorth)
         turnleft();
   }

define turnRight()
   {
      iterate(3)
         turnleft();
   }

define walkRight()
   {
      if(frontIsBlocked)
         {
            turnleft();
            walkRight();
            move();
            turnRight();
            move();
         }
      else
         {
            move();
            if(rightIsClear)
               {
                  turnRight();
                  move();
                  if(rightIsClear)
                     {
                        turnRight();
                        move();
                     }
                  else
                     {
                        walkRight();
                        turnleft();
                     }
               }
            else
               {
                  walkRight();
                  move();
               }
         }
   }
program()
{
   faceNorth();
   walkRight();
   turnoff();
}
                        
}
