## Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Prog: DunaiCsaba3.cpp // Draw turtle graphics #include #include void rose (const unsigned int i, const unsigned int angle) { if (i == 0) { ifm::right(angle); ifm::forward(); ifm::left(angle); ifm::forward(); ifm::right(angle); ifm::forward(); ifm::right(180); ifm::forward(); ifm::right(angle); ifm::forward(); ifm::left(angle); ifm::forward(); ifm::right(angle); ifm::forward(); } else { rose(i-1, angle); // for(int j=3;j>i; --j) ifm::forward(); ifm::right(150); // for(int j=4;j>i; --j) ifm::forward(); rose(i-1, angle); } } // POST: the word w_i^F is drawn void f (const unsigned int i, const unsigned int angle) { if (i == 0) { } else { ifm::forward(); ifm::forward(); ifm::forward(); ifm::forward(); ifm::forward(); ifm::forward(); ifm::save(); ifm::right(angle); f(i-1, angle-0); ifm::restore(); ifm::save(); f(i-1, angle+12); rose(8,60); ifm::restore(); ifm::left(angle); f(i-1, angle-0); } } int main () { std::cout << "Number of iterations =? "; unsigned int n; //std::cin >> n; std::cout << "Angle =? "; unsigned int a; //std::cin >> a; // draw w_n = w_n(F) // for(int i=1; i<360; ++i){ f(6,15); // } return 0; }