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 //Program: HitzCarola1.cpp //Autor: Carola Hitz Student // Draw turtle graphics for the Lindenmayer system #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::left(90); // + f(i-1); // w_{i-1}^F ifm::jump (2); //jump 2 steps ifm::right(90); // - f(i-1); //w_{i-1}^F ifm::left (90); // + f(i-1); //w_{i-1}^F ifm::jump (2); //jump 2 steps ifm::right(90); // - }} int main () { std::cout << "Number of iterations = 7 "; unsigned int n = 7; // draw w_n = w_n(F) f(n); return 0; }