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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Prog: WertnikMelina.cpp // IFMP - Serie 11 - Aufgabe 127 // author: melina wertnik // n > 100 #include #include // necessary: x and y call each other void y (const unsigned int i); void z (const unsigned int i); void k (const unsigned int i); //POST: function for drawing maru san void x (const unsigned int i) { if (i > 0) { ifm::forward(); ifm::left(75); ifm::save(); ifm::save(); ifm::right(60); ifm::forward(); y(i-1); ifm::restore(); z(i-1); k(i-1); z(i-1); k(i-1); z(i-1); k(i-1); z(i-1); k(i-1); ifm::restore(); k(i-1); z(i-1); k(i-1); z(i-1); k(i-1); z(i-1); k(i-1); z(i-1); } } // POST: part of maru san void y (const unsigned int i) { if (i > 0) { ifm::forward(); ifm::left(); x(i-1); ifm::right(30); ifm::forward(2); } } //POST: leftturns void z (const unsigned int i) { if (i > 0) { ifm::left(30); ifm::forward(2); } } //POST: rigtturns void k (const unsigned int i) { if (i > 0) { ifm::right(30); ifm::forward(2); } } int main () { std::cout << "Number of iterations =? "; unsigned int n; std::cin >> n; // draw maru san x(n); return 0; }