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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Informatik - Serie 11, Challenge 127 // H. S. Minoretti // Program: MinorettiSara.cpp #include #include //PRE: unsigned int i, which is the number of iterations //POST: the word w_i^F is drawn void f (const unsigned int i) { if (i==0) ifm::forward(); else { ifm::left(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::left(30); f(i-1); ifm::right(60); f(i-1); ifm::save(); ifm::left(60); if (i > 1) f(i-1); else ifm::jump(); ifm::restore(); ifm::right(60); if (i > 1) f(i-1); else ifm::jump(); } } int main() { std::cout<<"Number of iterations=? "; unsigned int n; std::cin>>n; //draw w_n=w_n(F) f(n); return 0; }