// Informatik - Serie 11 - Skript-Aufgabe 127
// Prog: VisintiniRoberto.cpp
// Nice with 9 iterations, with more it's just like Kandisky's black spot.
// Author: Roberto Visintini
#include
#include
void y (const unsigned int i);
// POST: the word w_i^X is drawn
void x (const unsigned int i) {
if (i == 0)
ifm::forward(); // F
else {
x(i-1);
ifm::right(140);
ifm::forward (3);
x(i-1);
ifm::left(90);
}
}
// POST: the word w_i^Y is drawn
void y ( const unsigned int i) {
if (i == 0)
ifm::forward();
else {
y(i-1);
ifm::left (45);
ifm::forward (2);
ifm::restore ();
y(i-1);
ifm::right (90);
}
}
int main () {
std::cout << "Number of iterations =? ";
unsigned int n;
std::cin >> n;
// draw w_n = w_n(F)
x(n);
return 0;
}