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 // Programm: VischerLucas1.cpp // Autor: L. Vischer // I recommend at least 7 iterations, but note that 9 iterations will take // about 30s calc. time. #include #include void g(unsigned int i); void f(unsigned int i) { if (i == 0) ifm::forward(1); else { f(i-1); ifm::left(90); f(i-1); ifm::right(90); g(i+1); } } void g(unsigned int i) { if (i == 0) ifm::forward(1); else { ifm::right(90); g(i-1); ifm::left(90); g(i-1); ifm::left(90); if (i > 1) f(i-2); else ifm::forward(1); } } int main() { std::cout << "Number of iterations?\n"; unsigned int n; std::cin >> n; f(n); return 0; }