Department of Computer Science | Institute of Theoretical Computer Science | CADMO

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Informatik - Serie 10 - Aufgabe 123 // Program: DebusPascal3.cpp // Autor: P. Debus (Gruppe L) #include #include void y (const unsigned int i); // POST: w_i^X is drawn void x (const unsigned int i) { const char xprod[]="X+Y++Y-X--XX-Y+"; if(i==0) ifm::forward(); // X else { for(const char* p = xprod; *p != '\0'; ++p){ switch(*p){ case 'X': x(i-1); break; case 'Y': y(i-1); break; case '+': ifm::left(60); break; case '-': ifm::right(60); break; default: break; } } } } // POST: w_i^Y is drawn void y (const unsigned int i) { const char yprod[]="-X+YYY++Y+X--X-Y"; if(i==0) ifm::forward(); // Y else { for(const char* p = yprod; *p != '\0'; ++p){ switch(*p){ case 'X': x(i-1); break; case 'Y': y(i-1); break; case '+': ifm::left(60); break; case '-': ifm::right(60); break; default: break; } // X } } } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin >> n; // s y(n); return 0; }