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 - Skriptaufgabe 125 // Programm: LebedevAnton.cpp //Author: Anton Lebedev #include #include "IFM/turtle" using namespace std; void f(const unsigned i){ if(i==0){ ifm::forward(2); } else{ //following the rule F->FF-[-F+F+F]+[+F-F-F] f(i-1); f(i-1); ifm::left(23); ifm::save(); ifm::left(23); f(i-1); ifm::right(23); f(i-1); ifm::right(19); f(i-1); ifm::restore(); ifm::right(23); ifm::save(); ifm::right(23); f(i-1); ifm::left(23); f(i-1); ifm::left(23); f(i-1); ifm::restore(); } }; int main(void){ unsigned n; cout<<"Please enter the number of iterations(>6 => black mass): "<>n; f(n); return 0; }