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 127 //Autor: Karim el Haqyawan //Prog: ElHaqyawanKarim2.cpp //Draw turtle graphics for the Lindenmayer system with //production #include #include // POST: the word w_i^F is drawn void f (const unsigned int i) { if (i == 0){ ifm::forward(); ifm::save(); ifm::right(30); ifm::forward(); ifm::left(80); ifm::forward(); ifm::left(100); ifm::forward(); ifm::left(80); ifm::forward(); ifm::restore(); } else { ifm::forward(); ifm::save(); ifm::right(30); ifm::forward(); ifm::left(80); ifm::forward(); ifm::left(100); ifm::forward(); ifm::left(80); ifm::forward(); ifm::restore(); ifm::jump(2); f(i-1); } } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin >> n; // draw for(int i = 1; i <= 36*n; ++i){ ifm::save(); f(n); ifm::restore(); ifm::right(360/(n*10)); } return 0; }