// Informatik - Serie 11 - Challenge
// Programm: ZurmuehleDaniel.cpp
// Autor: Daniel ZurmŸhle
#include
#include
void g (const unsigned int i);
void f (const unsigned int i) {
if(i==0)
ifm::forward();
else {
g(i-1);
ifm::left(45);
f(i-1);
ifm::left(45);
}
}
void g (const unsigned int i) {
if(i==0)
ifm::forward();
else {
f(i-1);
ifm::right(45);
g(i-1);
ifm::right(45);
}
}
int main () {
// input higher than 20 not recommended
std::cout << "Number of iterations =? ";
unsigned int n;
std::cin >> n;
// Draw curve
f(n);
return 0;
}
// interesting variations: Angles starting from the first from the top
// 90-60-90-60 ; 360-180-90-45 ; 60-60-60 ; 45-90-135-180 ;
// 90-90-90-90 ; 45-90-45-90 ; 1-10-100-1000 ; 10-100-1000-10000;
// 20-40-80-120