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 125 // Program: KuengOliver.cpp // Author: Oliver KŸng #include #include void gogo (const unsigned int i); void func (const unsigned int i); void gogo (const unsigned int i){ if (i==0 || i==1) ifm::forward(); else { gogo(i-1); gogo(i-2); } } void func (const unsigned int i){ if ( i!= 0) { ifm::save(); gogo(i-1); ifm::right(120); gogo(i-1); func(i-1); ifm::restore(); ifm::left(60); gogo(i-1); func(i-1); } } int main () { std::cout << "Number of iterations =? "; unsigned int nn; std::cin >> nn; func(nn); return 0; }