// Informatik - Serie 11 - Skript-Aufgabe 127
// Programm: NoserJonas.cpp
// Draw turtle graphics for the Lindenmayer system with
// Schšn mit 18 Iterationen
// Autor: Jonas Noser (Gruppe D)
#include
#include
// necessary: x and y call each other
void y (const unsigned int i);
// POST: w_i^X is drawn
void x (const unsigned int i) {
if (i > 0) {
x(i-1);
ifm::left(50);
y(i-1);
ifm::forward();
ifm::left(100);
}
}
// POST: w_i^Y is drawn
void y (const unsigned int i) {
if (i > 0) {
ifm::right(50);
ifm::forward();
ifm::right(50);
x(i-1);
ifm::right(100);
y(i-1);
}
}
int main () {
std::cout << "Number of iterations =? ";
unsigned int n;
std::cin >> n;
// draw w_n = w_n^X
x(n);
return 0;
}