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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Prog: AmmonAurelian.cpp // Draw turtle graphics for the Lindenmayer system // and rotation angle 90 degrees // n = 10, 15, 20 #include #include using namespace ifm; void y (const unsigned int i); void z (const unsigned int i); void a (const unsigned int i); // POST: X void x (const unsigned int i) { if (i > 0) { x(i-1); ifm::left(90); y(i-1); ifm::forward(); ifm::left(90); } } // POST: Y void y (const unsigned int i) { if (i > 0) { ifm::right(90); ifm::forward(); z(i-1); ifm::right(90); y(i-1); } } // POST: Z void z (const unsigned int i) { if (i > 0) { ifm::left(90); ifm::forward(); ifm::forward(); a(i-1); ifm::right(90); jump(3); z(i-1); a(i-1); } } // POST:A void a (const unsigned int i) { if (i > 0) { ifm::left(90); jump(12); ifm::forward(); a(i-1); ifm::left(90); y(i-1); } } int main () { std::cout << "wieviele Iterationen = "; unsigned int n; std::cin >> n; // zeichne w_n x(n); return 0; }