// Informatik - Serie 11 - Challenge 125
// Program: BuddeKai2.cpp
// Author: Kai Budde
// Draw an amazing picture (this case: "THE BRAIN")
#include
#include
// PRE: Please enter n==10
// POST: the "brain" is drawn
void f (const unsigned int i) {
if (i == 0)
ifm::forward(); // F
else {
f(i-1);
ifm::forward(2);
ifm::save();
ifm::left(45);
ifm::forward();
f(i-1);
ifm::restore();
ifm::save();
ifm::right(45);
ifm::forward();
f(i-1);
ifm::restore();
}
}
int main () {
std::cout << "Number of iterations =? ";
unsigned int n;
std::cin >> n;
// draw the picture
ifm::left(90);
f(n);
return 0;
}