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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Prog: SmirnowAlex1.cpp // Lindenmayer Challenge #include #include void f (const unsigned int i) { if (i == 0) ifm::forward(30); else { f(i-1); ifm::left(45); f(i-1); ifm::left(45); } } void g (const unsigned int i) { if (i == 0) ifm::forward(); else { for(int a=0; a<=360;++a) { ifm::forward(1000); ifm::left(1); } g(i-1); } } void h (const unsigned int i) { if (i == 0) ifm::forward(); else { ifm::left(20); ifm::forward(7500); g(1); ifm::left(20); h(i-1); } } int main () { std::cout << "Number of iterations =?(best you try it with n=17) "; unsigned int n; std::cin >> n; // draw f(n); ifm::save(); g(n); h(n); ifm::restore(); f(n); ifm::save(); g(n); h(n); ifm::restore(); f(n); ifm::save(); g(n); h(n); ifm::restore(); f(n); g(n); h(n); return 0; }