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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Program: BrunnerMaximilan.cpp // Production of a recursive defined function with turtle grafics. // Serie 11; Aufgabe 127 // Author: Maximilian Brunner #include #include using namespace std; void f (const unsigned int i){ if (i > 0){ ifm::forward(); ifm::save(); //save ifm::left(22); //left ifm::forward(); if (i > 1){ ifm::save(); //save ifm::right(22); //right ifm::restore(); } ifm::restore(); //zurückh zu speicherpunkt ifm::right(22); //rechts ifm::forward(); //F if (i > 1){ ifm::save(); //save ifm::left(22); //left f(i-1);} ifm::restore(); ifm::save(); f(i-1); }} int main () { cout << "Number of iterations =? "; unsigned int n; cin >> n; f(n); return 0; }