Department of Computer Science | Institute of Theoretical Computer Science | CADMO

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

//Autor: Martin Stoller //Program: lindenmayer2.cpp #include #include void X(unsigned int i); void Y(unsigned int i){ if(i == 0) { ifm::forward(); } else { Y(i-1); ifm::left(60); X(i-1); ifm::left(60); Y(i-1); } } void X(unsigned int i){ if (i == 0) { ifm::forward(); //Oder Y(0) } else { X(i-1); ifm::right(60); Y(i-1); ifm::right(60); X(i-1); } } int main(){ unsigned int n; std::cout << "Anzahl Iterationen n = ? "; //Eingabe n = 9 std::cin >> n; X(n); ifm::right(60); Y(n); ifm::right(60); X(n); return 0; }