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 - Challenge 125 // Prog: BagaricDominik2.cpp // Autor: Bagaric Dominik // Draw more beautiful turtle graphics for the Lindenmayer system with // production F -> F+F+ and initial word F. // Autor Bagaric Dominik #include #include // POST: the word w_i^F is drawn void f (const unsigned int i) { if (i == 0) ifm::forward(); // F else { f(i-1); // w_{i-1}^F ifm::right(30); f(i-1); ifm::left(60); f(i-1); ifm::right(30); f(i-1); ifm::left(60); // } } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin >> n; //n==8 // draw w_n = w_n(F) f(n); return 0; }