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: WidmayerFontaine.cpp // Autor: Fontaine Widmayer #include #include void r (const unsigned int l); void f (const unsigned int l) { if (l==0) ifm::forward(); else { f(l-1); f(l-1); r(l-1); ifm::left(83); ifm::save(); //Position gespeichert ifm::left(83); f(l-1); ifm::right(83); f(l-1); ifm::restore(); //laedt gespeicherte Position ifm::right(83); ifm::save(); ifm::right(83); f(l-1); ifm::left(83); f(l-1); ifm::restore(); } } void r(const unsigned int l){ if (l==0) ifm::forward(); else { r(l-1); r(l-1); f(l-1); ifm::right(83); ifm::save(); ifm::right(83); r(l-1); ifm::left(83); r(l-1); ifm::restore(); ifm::left(83); ifm::save(); ifm::left(83); ifm::right(83); ifm::right(83); ifm::restore(); } } int main() { std::cout << "number of iterations =?"; unsigned int n=7; std::cin >> n; ifm::save(); f(n); // w_n^F ifm::restore(); ifm::left(26); // look up f(n); // w_n^F return 0; }