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 - Aufgabe 107 // Programm: HeinrichCarsten.C // Autor: Heinrich Carsten #include #include void f (unsigned int n, int m, int c,int sa){ if (n==0) { ifm::forward(); return; } if (sa > 190 || sa < -190 ){m = 0;} f(n-1,m,c,sa + m); ifm::save(); ifm::right(m); f(n-1,m,c,sa+m); ifm::left(m); f(n-1,m,c,sa+m); ifm::restore(); } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin>>n; std::cout << "Winkel?"; unsigned int m; std::cin>>m; int c = 0; ifm::left(90); ifm::save(); f(n,m,-c,0); ifm::restore(); f(n,-m,c,0); return 0 ; }