Kara looks for the next leaf in the following order (see picture below):

The following part of the program implements this search:

kara.move();      
if (!kara.onLeaf()) {     
  turnAround();           
  kara.move();
  kara.turnRight();
  kara.move();
  if (!kara.onLeaf()) {   
    turnAround();         
    kara.move();
    kara.move();
  }
}
kara.removeLeaf();