/*
Program: SchumacherSalome2.cpp
Autor: Salome Schumacher
Titel: krauti.cpp
*/
#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(); // F
else {
y(i-1);
ifm::save();
ifm::left(25.7);
x(i-1);
ifm:: restore();
ifm::save();
ifm::right(25.7);
x(i-1);
ifm::restore();
y(i-1);
x(i-1);
}
}
void y(const unsigned int i)
{
if(i==0)ifm::forward();
else
{
y(i-1);
y(i-1);
}
}
int main () {
std::cout << "Number of iterations =? ";
unsigned int n;
std::cin >> n;
// draw w_n = w_n^F++w_n^F++w_n^F
x(n);
return 0;
}