Kara läuft solange gerade aus, bis rechts und links von ihm ein Baum ist. Anschliessend läuft er weiter, bis entweder rechts oder links kein Baum mehr ist.
public void myProgram() {
while (! (kara.treeLeft() && kara.treeRight())) {
kara.move();
}
while (kara.treeLeft() && kara.treeRight()) {
kara.move();
}
}