// Informatik - Serie 11 - Skript-Aufgabe 127
// Program: SchroederMalte.cpp
// Autor: M. C. Schršder
// n=12 fŸr Rudolph das Rentier
#include
#include
void y (const unsigned int i);
// POST: the word w_i^F is drawn
void x (const unsigned int i)
{
if(i==0)
{
ifm::forward();
}
else
{
x(i-1);
ifm::right(30);
y(i-1);
ifm::right(30);
y(i-1);
ifm::right(30);
x(i-1);
}
}
// POST: w_i^Y is drawn
void y (const unsigned int i) {
if(i==0)
ifm::forward();
else {
x(i-1);
ifm::left(70);
y(i-1);
ifm::left(70);
x(i-1);
}
}
int main () {
std::cout << "Number of iterations =? ";
unsigned int n;
std::cin >> n;
x(n);
return 0;
}