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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Author: Timo Welti // Prog: WeltiTimo1.cpp #include #include void y (const unsigned int i); void x (const unsigned int i) { if (i > 0) { ifm::forward(2); ifm::save(); ifm::left(30); ifm::forward(); x(i-1); ifm::restore(); ifm::save(); ifm::right(30); ifm::forward(); x(i-1); ifm::restore(); ifm::forward(); } } void y (const unsigned int i) { if (i > 0) { ifm::save(); ifm::right(15); ifm::jump(); x(i-1); ifm::restore(); ifm::save(); ifm::left(15); ifm::jump(); x(i-1); ifm::restore(); } } int main () { std::cout << "Number of iterations (around 15)=? "; unsigned int n; std::cin >> n; ifm::left(90); y(n); x(n); return 0; }