Kara walks the slalom in an endless loop around the trees. He alternates left and right turns as follows:

while 1:
  while kara.treeLeft() and notkara.treeRight():
    quarterTurnLeft()

  quarterTurnRight()

  while not kara.treeLeft() and kara.treeRight():
    quarterTurnRight()

  quarterTurnLeft()