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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// IFMP Serie 9 Aufgabe Challenge // Programme: crown.cpp with 9 iterations draws a "Christmas crown" (does it converge?) // Number of iterations: 9 // Author: Nicola Nesa, Gruppe I #include #include // POST: the word w_i^F is drawn void f (const unsigned int i) { if (i == 0) ifm::forward(); else { f(i-1); ifm::left(60); f(i-1); ifm::right(120); f(i-1); ifm::right(60); f(i-1); } } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin >> n; f(n); ifm::left(90); f(n); ifm::left(90); f(n); ifm::left(90); f(n); return 0; }