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: teddybear2.cpp: with 7 iterations there's a teddy-bear monster! // swapping the other two 72 with 73 you also have interesting figures, but // swapping just one of them with the central 73 it doesn't almost change anything! // Number of iterations: 7 // 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(108); f(i-1); ifm::right(72); f(i-1); ifm::right(73); f(i-1); ifm::right(72); f(i-1); ifm::left(108); f(i-1); } } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin >> n; ifm::left(60); for (int k=1; k<=4; ++k) { f(n); ifm::left(90); } return 0; }