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 // Prog: ScanzioAndrea.cpp // Author: A.Scanzio // Best with 5/6 iterations. #include #include using namespace ifm; void h(const unsigned int i){ if(i>0){ forward(i); save(); left(60); forward(i); h(i-1); restore(); save(); left(30); forward(i); h(i-1); restore(); save(); right(15); forward(i); h(i-1); restore(); save(); right(30); forward(i); h(i-1); restore(); forward(); h(i-1); } else{ forward(); } } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin >> n; save(); h(n); restore(); right(180); h(n); return 0; }