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 //program: KellerTobias1.cpp //Author: Tobias Keller //This program draws a Lindenmayer system with Turtle //best drawing results obtained for n = 13 #include #include using namespace ifm; void f (const unsigned int n) { if (n == 0) forward(); else { f(n-1); } } void g (const unsigned int n) { if (n == 0) forward(); else { f(n-1); save (); left (30); g(n-1); restore (); f(n-1); right (20); save (); g(n-1); left (30); restore (); g(n-1); } } int main() { unsigned int n; std::cout << "number of iteration steps?\n"; std::cin >> n; g(n); return 0; }