// Informatik - Serie 11 - Aufgabe 127
// Programm: PangHeidi.cpp
// Autor: H. Pang
// Draw turtle graphics for the Lindenmayer system with
// production F -> F++FF+++F- and initial word F
// rotation angle: 30 degrees
#include
#include
// POST: the word w_i^F is drawn
void f (const unsigned int i) {
if (i == 0)
ifm::forward(); // F
else {
f(i-1); // w_{i-1}^F
ifm::left(60); // ++
f(i-1); // w_{i-1}^F
f(i-1); // w_{i-1}^F
ifm::left(90); // +++
f(i-1); // w_{i-1}^F
ifm::right(30); // -
f(i-1); // w_{i-1}^F
}
}
int main () {
std::cout << "Number of iterations =? ";
unsigned int n;
std::cin >> n;
// draw w_n = w_n(F)
f(n);
return 0;
}