// Informatik - Serie 11
// Programm: KlopfensteinYannick.cpp
// Autor: Yannick Klopfenstein
#include
#include
#include
void f (const int i) {
if (i <= 0) {
ifm::forward(); // F
}
else {
int p = (rand()%25)+1;
ifm::save();
ifm::left(p);
ifm::forward(2*i);
f(i-1);
ifm::restore();
ifm::forward();
ifm::save();
ifm::right(p);
ifm::forward(2*i);
f(i-1);
ifm::restore();
}
}
// necessary: x and y call each other
void y (int i, int j);
//void z (int i, int j);
int b = 0;
void x (const int i) {
for ( int j = 6; j > 0; --j) {
y(i,1);
ifm::left(60); }
}
void y (int i, int j) {
if (i <= 1)
;
else {
f(i);
y(i-1,j);
ifm::forward(20/i/j);
y(i-1,j);
ifm::right(30);
y(i-1,j+1);
ifm::left(60);
y(i-1,j+1);
ifm::left(150);
ifm::forward(20/i/j);
ifm::left(180);
}
}
int main () {
std::cout << "Number of iterations =? ";
int n;
std::cin >> n;
// draw w_n = w_n(F)
x(n);
return 0;
}