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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Prog: SchmidtPeterMaximilian.cpp // Peter-Maximilian Schmidt // Draw turtle graphics for the Lindenmayer system // at variable rotation angle //USE NUMBER OF ITERATIONS:: 3008 :: #include #include void y (const unsigned int i); // POST: w_i^X is drawn void x (const unsigned int i) { if (i > 0) { ifm::left(180-i); ifm::forward(); ifm::left(180-i); ifm::forward(); ifm::left(180-i); y(i-1); } } // POST: w_i^Y is drawn void y (const unsigned int i) { if (i > 0) { ifm::right(180-i); ifm::forward(); ifm::right(150-i); ifm::forward(); ifm::right(120-i); x(i-1); } } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin >> n; x(n); y(n); return 0; }