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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Informatik - Serie 11 - Aufgabe 107 // Program: MarvinUhlmann.C // Autor: Marvin Uhlmann (Gruppe C) // Draw turtle graphics for the Lindenmayer system with // production F -> F+F+ and initial word F. // // nicest picture with n = 8 or 9 #include #include void P(int a) {ifm::left(a);} void M(int a) {ifm::right(a);} void Auf() {ifm::save();} void Zu() {ifm::restore();} // POST: the word w_i^F is drawn void F (unsigned int i) { int a=45; if (i == 0) ifm::forward(); // F else { P(a);F(i-1);Auf();P(a);F(i-1);Zu();F(i-1); } } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin >> n; // draw w_n = w_n(F) P(90); F(n); return 0; }