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 127 // Prog: CruzMajorie.cpp // Draw turtle graphics for the Lindenmayer system with // production F -> F-F- [Ff + Ff |] +F+F] and initial word F. // Autor: M.Cruz #include #include // POST: the word w_i^F is drawn void f (const unsigned int i) { if (i == 0) ifm::forward(); // F else { f(i-1); ifm::right(44); f(i-1); ifm::right(44); ifm::save(); f(i-1); ifm::jump(); ifm::left(44); f(i-1); ifm::jump(); ifm::right(44); ifm::restore(); ifm::left(44); f(i-1); ifm::left(44); f(i-1); } } int main () { // draw w_6(F) f(6); return 0; }