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 not kara.onLeaf():
    turnAround()            
    kara.move()
    kara.turnRight()
    kara.move()
    if not kara.onLeaf():
      turnAround()           
      kara.move()
      kara.move()
  kara.removeLeaf()