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 Exercise 125 // Program: WolffFranz2.cpp // Author: Franz Wolff #include #include using namespace ifm; void f (const unsigned int n) { if (n == 0) forward(); else { f(n-1); f(n-1); } } void g (const unsigned int n) { if (n == 0) forward(); else { f(n-1); save(); left(20); g(n-1); restore(); f(n-1); save(); right(20); g(n-1); restore(); left(20); g(n-1); } } int main() { int n; std::cout << "number of iteration steps?\n"; std::cin >> n; g(n); return 0; }