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 - Skript-Aufgabe 127 //Programm: JavetNoe.cpp //Draw fractals with turtle graphics //Autor: Noe Javet #include #include //declaration of function g void g (const unsigned int i); //definition of the production f with initial word F //POST: the word w_i^F is drawn void f (const unsigned int i) { if (i == 0) ifm::forward(); //initial word F else { ifm::jump(1); f(i - 1); ifm::left(42); g(i - 1); ifm::left(42); } } //definition of g void g (const unsigned int i) { if (i == 0) ifm::forward(); else { ifm::save(); g(i - 1); f(i - 1); ifm::left(42); } } int main() { //initialisation of the iteration steps and input std::cout << "number of iterations n = "; unsigned int n; std::cin >> n; //drawing f(n); return 0; }