// Prog: SandholzerKilian.cpp
// Draw turtle graphics for the Lindenmayer system with
// production F+ -> +FF+ and initial word F+.
// Author: K. Sandholzer
// Serie 11 - Aufgabe 127
#include
#include
// POST: the word w_i^F is drawn
void f (const unsigned int i) {
if (i == 0){
ifm::forward(); // F
ifm::left(1); // +
}
else {
ifm::right(90); //+
f(i-1); //F
f(i-1); //F
ifm::right(90); //+
}
}
int main () {
std::cout << "Number of iterations =? ";
unsigned int n;
std::cin >> n;
// draw w_n = w_n(F)
f(n);
return 0;
}