Kara walks around the trees in an endless loop. In each step, he considers the sensors "tree front?" and "tree right?" to determine the appropriate action.
while true if kara.treeFront and kara.treeRight kara.turnLeft else if not kara.treeFront if kara.treeRight kara.move else kara.turnRight kara.move end end end end