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 - Challenge-Aufgabe 127 // Programm: ScybozLudovic.cpp // Autor: L. Scyboz #include #include //POST: the word F -> FF[+F-F+FF]F+FF-F is drawn void f(const unsigned int i) { if(i==0) ifm::forward(); else { f(i-1); f(i-1); ifm::save(); ifm::left(30); f(i-1); ifm::right(30); f(i-1); ifm::right(30); f(i-1); f(i-1); ifm::restore(); f(i-1); ifm::left(30); f(i-1); f(i-1); ifm::right(30); f(i-1); } } int main() { std::cout << "Number of iterations: "; unsigned int n; std::cin >> n; //Basic word +F-F+F with degrees 90, respectively 10, 10 ifm::left(90); f(n); ifm::right(10); f(n); ifm::left(10); f(n); return 0; }