I can not understand by what principle this code works. This is the first part of the code:
* @author ZTILabPI */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here TurtleAlgorithms alg = new TurtleAlgorithms(); alg.positioningTurtle(30); // alg. sierpinski(bok, minBok); alg.sierpinski(200, 50); // alg.callSnowFlake(3, 400); // alg.snowFlake(3, 400); } } This is the second part of the code:
package Turtle; import turtlePck.TurtleGraphicsWindow; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author ZTILabPI */ public class TurtleAlgorithms extends TurtleGraphicsWindow{ public void positioningTurtle(int angle){ right(angle); } public void sierpinski(int bok, int minBok ){ if (bok<minBok) { return; } for(int i=1;i<4;i++){ sierpinski(bok/2, minBok); forward(bok); right(120); } } } It turns out that this code works, it draws the Sierpinski triangle, but I cannot understand by what principle.