Better docs, remove WIP Taruga interpreter code
[taruga.git] / examples / koch.cpp
blob7279a43e517d5f17e2a717bc2884e1aecf4ed7cd
1 #include "include/taruga.hpp"
3 void recursive_koch(taruga::Turtle& turtle, int length, int depth)
5 if(depth == 0)
7 turtle.forward(length);
8 return;
10 recursive_koch(turtle, length, depth-1);
11 turtle.turn_right(60);
12 recursive_koch(turtle, length, depth-1);
13 turtle.turn_left(120);
14 recursive_koch(turtle, length, depth-1);
15 turtle.turn_right(60);
16 recursive_koch(turtle, length, depth-1);
19 int main()
21 taruga::Turtle turtle;
23 turtle.pen_up();
24 turtle.turn_right(90);
25 turtle.backwards(850);
26 turtle.turn_left(90);
27 turtle.forward(190);
28 turtle.turn_right(90);
30 turtle.pen_down();
31 recursive_koch(turtle, 5, 5);
33 turtle.act();
35 return 0;